Change The Upperbound Of An Array Once It Has Been Instantiated?

Jun 15, 2009

Is it possible to change the upperbound of an array once it has been instantiated? I want to change the upperbound in an array so it matches the number of items that hold a value.

View 11 Replies


ADVERTISEMENT

Arrays Without Known Upperbound Into Txt File?

Jan 17, 2012

how I would save the contents of several comboboxes (that will have several records added at a time) to a txt file. I would use an array, but I don't how this is done when one doesn't know how the total number of records to be saved. Would I use a loop? Haven't really dealt with anything yet that has unlimited number of entries.

View 4 Replies

Access Instance Already Instantiated?

Mar 31, 2010

I create an Instance of Access to view a report through my app.I would like to check if an Instance of Access has either already been opened by the user, or by the app. If so, use that instance.

Dim oAccess As Access.Application
Public Sub CreateAccessInstance()
Try[code]...

As it stands now, It creates multple MSACCESS.EXE processes which are running until I exit the app.

View 9 Replies

Cannot Seem To Get Sub From An Instance Of Class Once Instantiated?

Sep 11, 2009

I think I just need a push in the right direction. I cannot seem to get my sub from an instance of my class, once instantiated, to run when I click on the button. My Code in the class is

When I click this:Private Sub btnBark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBark.Click
mydawg.bark()
End Sub

[Code]...

View 2 Replies

Where Does A Startup Form Get Instantiated

Sep 10, 2009

When developing a Windows Forms Application, I can see in the Application.Designer.vb file where Me.MainForm = Form1, but I can't find where/how Form1 actually gets newed-up.

View 3 Replies

Wpf - Custom Control Can Only Be Instantiated Once?

Mar 8, 2012

I am new to WPF and custom controls.I have implemented a custom control in VB with WPF and MVVM based on Davids example: [URL]..I have a custom control libary and a reference to my project to implement my control.I implement my contol in the View via XAML:

[Code]...

View 2 Replies

Instantiated OCX Object Has No Event Fired?

Jan 6, 2011

problem with no event fired after the wrapped ocx object with aximp sent out the message in a console application testing.

View 3 Replies

Oop - Particular Object May Be Instantiated Only Once During Program Execution?

Dec 27, 2009

VB.NET: What is the best way to ensure that a particular object may be instantiated only once during program execution?

View 3 Replies

Using A Cookie / Session Instantiated By Another Application?

Mar 13, 2012

I have a customer intranet (ASP.NET / VB) thats instantiating an asp.net session checking various things in the dblogin process. The Intranet has various sub-systems.The marketing sub-system requires an app_role to be assigned to the Intranet user for them to view the section.I need to create a new booking form for this section but the code appears to use a generic form which is use throughout the site in various other sections. So its not a good idea to ammend what is currently there.Create a new application in C# / ASP.NET and also in IIS. (rather than a new site, create an app within the Intranet site in IIS)Will I be able to check for the session thats currenting set in the cookie?If the session is open then the user is able to see the Intranet and I assume I will need to do some checks for the app_role too.I am simply going to put the URL for the app in the menu for marketing and then do another check just incase someone gives the URL to someone who doesnt have access to the menu.Will i be able to check and use the cookie thats been instantiated by another application?

View 1 Replies

VS 2005 Using WithEvents With A Non-instantiated Class?

May 13, 2011

Can you raise events from a class that has only shared members and doesn't get instantiated? I originally had the class members non-shared and created instances of the class where I need them. I had the events being raised and everything worked as expected. But as the class members are actually application level and do not need instancing, I converted all members in the class to shared so they could be accessed from anywhere in the program without creating an instance of the class. But WithEvents requires the creation of a class instance. I've done that and it seems to work fine when using an instance. And since I need the events handled in only one class, I can create the instance in that class and let all other areas access the class directly, without creating an instance.

View 10 Replies

.net - Release A File Lock On A COM DLL That Has Been Instantiated Via `CreateObject`?

Dec 21, 2011

I have a .Net 4 WinForms app that generates a DLL, calls CreateObject on the generated DLL then calls one of several methods that the DLL contains. The DLL is eventually used by a separate app. This WinForms app is just to generate and test the DLL hence why it can generate the DLL multiple times.The problem lies in the fact that calling CreateObject on the DLL locks the file to the process. The next time the DLL is generated it can't overwrite the previous DLL file on disk without closing the app completely and starting it again.

I've tried Marshal.ReleaseComObject, executing the CreateObject in a separate AppDomain, even setting the variable holding the COM object to a different COM object via CreateObject, manually calling GC.Collect() and a whole host of other things but none result in unlocking the file.The code flow is basically (simplified and generic names, etc.):

...
' Compile and generate DLL that is COM enabled and works fine
...
Dim foo As Object = CreateObject("Bar.Foo")

[code]....

is there a way to release a file lock on a COM DLL that has been instantiated via CreateObject without killing the process?

Note: this is a continuation of this original issue. I now have the DLL registering without locking the file but now the issue is with the CreateObject call not the DLL registration.

View 1 Replies

C# - All Disposable Objects Instantiated Within A Using Block Disposed?

Feb 17, 2010

This is a question I have asked myself many times in the past as I nested using statements 5 deep. Reading the docs and finding no mention either way regarding other disposables instantiated within the block I decided it was a good Q for SO archives.

[Code]...

View 6 Replies

Classic Program Instantiated Excel Won't Close On Quit

Jul 31, 2009

This runs correctly, but Excel remains active after close.

If I don't create the range objects below, everything seems to work (with no output of course). Does anyone have any idea on how to keep Excel from staying in memory. Also... in the tests I'm running, I do not make the application visible.[code]...

View 3 Replies

Getting Button Events From Multiple Manually Instantiated Controls

Aug 30, 2011

I have created a simple custom control - we will call it a "panel with buttons". Here is how I instantiate it:

[Code]....

So what I wind up with are multiple instances of my panel. Each of these panels has a button on it called Button1.
My question is - how do I capture this button event in a way that I will know which panel index it came from?

In the custom control there is only the Button1_click event - and when I click on it in any of the multiple panels I manually instantiated the event does occur, but how I can tell which one of my instantiated buttons were clicked...

View 1 Replies

IDE :: Format Order Of Controls Instantiated By Code During Run Time

Feb 3, 2009

I am working on an application that requires buttons and links to be added during run time, it's a bit like a flow chart. The buttons are used to display information similar to a multi line text box, but I also use the click, double click and mouse events for these buttons. The links are drawn as label controls. My problem is that I want to control the format order of these controls with the buttons always being on the top layer and the labels one layer back so that when labels are added they aways pass behind the buttons. If this was done at design time it is very easy to use the menu Format > Order to get overlapping controls displayed the way I want. But, the controls placed on the form at run time do not have a Format or Order property.

View 1 Replies

.net - Can The Select Extension Method Project To A List Of Instantiated Objects

Mar 24, 2011

I have two lists declared as follows:

Dim lstDBItems As New List(Of DBItem)
Dim lstAppItems As New List(Of AppItem)

I am trying to do something like this:

I've a function which returns List(Of AppItem):

Function GetAppItems() As List(Of AppItem)
'...
End Function

In the above function I populate lstDBItems and then write the return statement like follows:

Return lstDBItems.Select(Function(x)
dim oItem As New AppItem()
oItem.Property1 = x.DbProperty1

[Code]....

The weird thing is the code compiles, but on rumtime I get a type case error.

View 3 Replies

Array Dimensions - Error Message 'ReDim' Cannot Change The Number Of Dimensions Of An Array?

Oct 20, 2011

I'm upgrading my VB6 project to VB.NET and I found one of the problem below relating to dimensional array.Here's my VB6 coding :

Private Function ConvertMatrixToBase0(ByVal MyMat() As Double) As Double()
Dim i, j As Long
Dim ConvMat() As Double[code.]...

When i port it over to VB.NET, i encountered error message 'ReDim' cannot change the number of dimensions of an array. for the line highlighted in red. And I suspect that VB.NET need to always define the exact dimension of the array during the declaration. But for the function above, for the array of 'MyMat()', I do not know what is the exact dimension every time it runs, and that is why i need to check the dimension of the array.My question is do we have any solution in dealing unknown dimension array in VB.NET? As in VB6, we can just define Array() instead of Array (,) in VB.NET.

View 6 Replies

Error : ActiveX Control '8856f961-340a-11d0-a96b-00c04fd705a2' Cannot Be Instantiated Because The Current Thread Is Not In A Single-threaded Apartment

Jul 24, 2009

I am trying to create a new thread that will import from an excel spreadsheet, because it was doing all the import before the form actually displayed to the screen. So the user never saw the form while it was importing..In the form's load event I create the thread and start it, but I get this large error:An error occurred creating the form. See Exception.InnerException for details. The error is: ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.

I am using visual studio 2005 pro on Vista Business?

View 2 Replies

Change This Php Array To .net?

Oct 14, 2011

i am currently looping through this with vb.net and writing on the console:

fruits orange
fruits banana
fruits apple

[code]....

however, i would like to store my values like this this:

array (
"fruits" => array (
"a" => "orange",
"b" => "banana",

[code]....

then when i get this, i would like to loop through each

array (
"fruit" => "orange",
"b" => "banana",
"c" => "apple"
)

and check for certain values.i can do this easily in php, however, vb.net leaves me?

View 1 Replies

How To Change One Element In Array

Aug 30, 2011

I am trying to read a comma delimited text file to an array, then change just one element in the array and write it back to the text file. An example of what the text file would look like is:

data1,data2,data3
data1,data2,data3
data1,data2,data3

I want to change data in the last line at the last postion , data3, for example. I am reading the file in with no problem. I am stuck on how to change the data and write it back to the text file.

View 4 Replies

Numbers Change When Put Into An Array?

Jun 2, 2011

I have a datagrid in my form and numbers are input it. I then loaded one of the columns into an array. This is the piece of my code that loads the array:

Me.dgv.CurrentCell = dgv(1, 0)
For i = 0 To (Me.dgv.RowCount - 1)
Receipts(i) = Convert.ToSingle(dgv(1, i).Value)
Next i

The first value is -2912895.29. I put the program in break-mode and it keeps loading the first value as -2912895.25. I checked and it loads all of the values a few cents off.

View 2 Replies

Change Size Of A Byte Array?

Jun 12, 2009

My app is receiving data in blocks but I don't know what size data will be received until it is finished, unlike file reading. So my app loads the data in chunks of 1024 bytes and then stops when there is no data to read. My question is, is it possible to keep increasing the size of a byte array as the data is being received?

View 2 Replies

Change Text Box Properties In An Array?

Jan 5, 2012

I'm trying the Text Box array suggested in a previous posting and getting only partial success. Here's the situation.

I want to change a control's back color based on a specific situation.

I have defined the array at theclass level for the form that I am working on, as[code]...

View 6 Replies

Change The Forecolor Of String Array?

Jan 11, 2012

how can i change the forecolor of may variable str2 and str1 if they are not equal. my idea hear is have a Typing master like to check the error.str2 change the forecolor to bluestr1 have a underline like a red line wrong spelling.

this is my code

HTML
Dim Str1 As Array
Dim str2 As Array
Dim x As Integer

[code]....

View 2 Replies

Method Calls On Objects That Aren't "Guaranteed" To Be Instantiated?

Sep 10, 2010

I recently wrote a section of code wherein upon finishing, I received a warning from the compiler telling me that one of my variables is being used before it is assigned a value. In practice, the method call on this object will never be made without the object being instantiated beforehand. Here is the snippet of code

Try
fs = New FileStream(fileName, FileMode.Open)
Dim PolarMatrix As PolarMatrix
PolarMatrix = DirectCast(bf.Deserialize(fs), PolarMatrix)

[code]....

I assume I'm receiving this warning because the first line in the Try section may be the line to throw the error, and the Object will never be instantiated. FileName though, is a variable being passed to this method which has already been checked for errors, so it is guaranteed to be correct. The error I'm expecting to perhaps be thrown comes during the deserialization.

So my question: When warnings are given on objects that the compiler thinks may not have been instantiated, does this overrule the user knowing that a problem will never arise on that line? Is it sometimes necessary to add code simply to appease the compiler?

View 1 Replies

'ReDim' Cannot Change The Number Of Dimensions Of An Array

Jun 30, 2009

I have an array declared:

[Code]...

This statement works fine in ASP, but when I switch to ASP.Net, it give errors 'ReDim' cannot change the number of dimensions of an array.

View 2 Replies

Apply Change To Instance Of Structure Within Array?

Nov 5, 2011

So I have an array which holds instances of a structure. The structure contains various string properties.

I'm looking to modify each instance of a structure within this array by doing the following:

For Each stuInstance As StuInstance In arrStuInstances stuInstance.strCarName = "Benz"

But I found that this in fact fails to really change it permanently. If I do the following loops in the given order:For Each stuInstance As StuInstance In arrStuInstances

[Code]...

View 2 Replies

Change A Line In A Listbox Build Up As An Array?

Jan 14, 2012

I've got a listbox in visual basic 2008 with lines that look like:

item 0; item 1; item 2; item 3

How can I select that line and change within that line the value of e.g. item 3? (by default it's set to 0 and should be set to a value > 0 when entered by the user.

After that I need to calculate the total price based on the price in item 2 and the new value of item 3 (being >0)

View 5 Replies

Change Color Of A Button Created From An Array?

Mar 4, 2009

I have created 3 arrays of buttons for a form which manipulates the value in a combo box or 2 by the name of the button ( buttons named 2 through to about 70 )

This works great but the problem is, now that the buttons are in, I want to be able to change the color of the buttons when another button is clicked

ie. The first bunch of buttons is a list of locations all with unique text.the second bunch of buttons is events that happen, sign on, sign off, beach open and beach closed.

What i want to be able to do is change the color of the button clicked "before" i click sign on, sign off, beach open or beach closed.

I do not know how to reference these buttons in my code as for starters, they are numbers, which is a big no no apparently. Also, even if i change the name from just a number to something like cmdBeach(i) when creating them, i still can't refer back to cmdBeach5 in my code as the button doesn't exist yet

View 3 Replies

Change Variables In An Array Without Knowing Their Index

Jun 10, 2011

This may sound quite basic, but i was wondering how to change the value of a variable in an array, not knowing the index value but knowing what the variable is.

For example, I have an array and I want all strings within it that haven't got a value to say "Stretched". here is what i have tried:

For Each stl As String In Me.stl
If stl = "" Then
stl = "Centered"
End If
Next

My array is called stl(), and the size of it is always changing, so i can't just change the specific variables within the array

Also, is there some way to show/change etc all variables in an array? e.g. msgbox(stl(all))

I know this won't work, but what will?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved