ShowDialog and ArrayList?

  • Thread starter Thread starter Strahimir Antoljak
  • Start date Start date
S

Strahimir Antoljak

I keep an ArrayList in the external class. The external class is passed into
a form via New constructor (see below). I process some data with functions
within the form before showing the form. I populate the array contained in
the passed class, then I show the form modally (frm.ShowDialog) so the user
can interact, and when the user closes the form, the array is emtpy.
Why??????
I check the Count property before, and after the showing the form and when I
close the form this empties array? Any idea? Help!!

Debug.WriteLine(en.alAnM.Count) ---> gives e.g. 16
Dim eResult As DialogResult = Me.ShowDialog
If eResult = DialogResult.Cancel Then
Exit Function
End If
Debug.WriteLine(en.alAnM.Count) ------> gives 0 !?


The array list alAnM is stored in the class within another project within
common solution (sln). Why the ShowDialog procedure empties array?





Public Sub New(ByRef _en As MyClass)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
en = _en
End Sub

Private en as MyClass
 
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.
 
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog

--
Strah @ Langan

Jonathan Allen said:
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.
 
Stuff to try...

Is alAnM a field or a property?
If it is a field, change it into a property and put a break point on its
getter and setter.

Change en to a property. Again, put a break point on its getter and setter.

--
Jonathan Allen


Strahimir Antoljak said:
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog
 
P.S. Don't use MyClass as a type name. MyClass and MyBase as keywords.

--
Jonathan Allen


Strahimir Antoljak said:
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog
 
Back
Top