473,490 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ShowDialog and ArrayList?

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


--
Strah @ Langan
Nov 21 '05 #1
4 1296
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.

--
Jonathan Allen
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...
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


--
Strah @ Langan

Nov 21 '05 #2
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog

--
Strah @ Langan

"Jonathan Allen" <x@x.x> wrote in message
news:um**************@TK2MSFTNGP14.phx.gbl...
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.

--
Jonathan Allen
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...
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


--
Strah @ Langan


Nov 21 '05 #3
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" <st***@netzero.net> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl...
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog

--
Strah @ Langan

"Jonathan Allen" <x@x.x> wrote in message
news:um**************@TK2MSFTNGP14.phx.gbl...
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.

--
Jonathan Allen
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...
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


--
Strah @ Langan



Nov 21 '05 #4
P.S. Don't use MyClass as a type name. MyClass and MyBase as keywords.

--
Jonathan Allen
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl...
I did that.... and the array is changed (emptied) at the moment:
form.ShowDialog

--
Strah @ Langan

"Jonathan Allen" <x@x.x> wrote in message
news:um**************@TK2MSFTNGP14.phx.gbl...
1. Add a watch for the array.
2. Step through the code until you find the moment that the array is
changed.

--
Jonathan Allen
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eY**************@TK2MSFTNGP15.phx.gbl...
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


--
Strah @ Langan



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3638
by: Richard L Rosenheim | last post by:
I would like to detect when a form is invoked as the result of a ShowDialog call. Anyone have any ideas or suggestions on how to do that? TIA, Richard Rosenheim
2
10180
by: Bill Burris | last post by:
When you crate a Windows application the wizard adds a line like: Application.Run( new MyMainForm() ); Out of curiosity I replaced this with: MyMainForm myForm = new MyMainForm();...
5
1576
by: Josh Golden | last post by:
3 forms. form 1, when button clicked instantiates form 2 which opens but is not shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises an event that form 2 catches. during the...
0
257
by: Strahimir Antoljak | last post by:
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...
4
4375
by: Dennis Sjogren | last post by:
Greetings! First, I'm not 100% sure where to post this question. I use VB.NET for this project, but it's really a design question (a question on which method to use when solving this problem). ...
6
4891
by: Samuel R. Neff | last post by:
I'm having weird results with a form that is already displayed modally (via ShowDialog) displaying a second form via ShowDialog. The last form is not modal even though it's called with ShowDialog....
1
2422
by: No Sheds | last post by:
Hi I have an MDI application. I have a MDI child window within this application that shows another form using ShowDialog. This works fine, except that the final form shown with ShowDialog...
4
5213
by: trialproduct2004 | last post by:
Hi all I am new to vb.net application. I am using showdialog property of form to display form. First time it is working properly. But next time it is giving me error that ' object reference not...
5
10868
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5445
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
618
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.