Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
(OP)
Ive made a programme on multiple forms which are activated from the main Form through buttons.
i am facing a little prob
when user complete the operation from, say form2, he exits from it to the main form, and if he want to perform the same operation he may choose to go back to form 2, but then i face errors as the Arrays that were initialised the first time still have old values in them though last time i have un loaded the form?
how should i prevent this?
i am facing a little prob
when user complete the operation from, say form2, he exits from it to the main form, and if he want to perform the same operation he may choose to go back to form 2, but then i face errors as the Arrays that were initialised the first time still have old values in them though last time i have un loaded the form?
how should i prevent this?





RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
Option Base 1
Dim MyArray() As String
'Initialize array (erases all entries)
Redim MyArray(1)
'Fill with 5 items
For i = 1 to 5
'Update depth of array - saving existing contents
Redim Preserve MyArray(i)
MyArray(i) = "Entry: " & i
Next i
'Report the contents back
For i = LBound(MyArray) To UBound(MyArray)
MsgBox MyArray(i)
Next i
'Clear the entire array
Redim MyArray(1)
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
should i do redimension each n every before unloading?
RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
As far as clearing the arrays, it really depends on your needs. Are these arrays global? If they are, you should have a need for them in other routines. If the data is only being used while the form is loaded, you should make the arrays local to the form. Then, they will automatically be released once you close the form.
DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection
erase myArray 'This frees up the memmory used by the array.
Are the arrays private to the particular form they are on? Or are they global variables?
Troy Williams
fenris@hotmail.com
RE: Re- Initialising Arrays in multiple forms (or maybe Garbage Collection