Multiple Forms Question [Resolved]
Hello,
This might be a really dumb question so please bear with me!!
I'm just starting with vb.net. I have an app with two forms. the first form has a menu item which opens up the second form.
Code in first Form:
Code:
Public Class Form1
Dim frmViewSelected As New frmViewSelImgs()
'
' Bunch o' Code
'
' Click Event For Menu Item
Private Sub mnuViewSelectedImgs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuViewSelectedImgs.Click
With frmViewSelected
.myImgArray = UploadArray
.Show()
.Focus()
End With
End Sub
This works ok ... until I close the second window and then try to open it again. I get an error saying that I can't acces an object that has been disposed - something like that.
It seems to me that when form1 loads it creates the frmViewSelected object --- but when that window is closed the object is destroyed or disposed of and the main form dosen't know what object frmViewSelected is.
Is there a better way to do this? This method was suggested by a .net book. It was the only way suggested.
Thanks!
-Rich