cementboot
Newcomer
- Joined
- Aug 27, 2005
- Messages
- 8
How can I refer to an form in array of forms?
Hi,
How can I refer to an form in array of forms?
In my project, I have created an array of forms in a module like this:
(clsDummyForm in the code above is a class in which I am inheriting System.Windows.Forms.Form)
The problem occurs when I try to use the CloseForms() sub from another form like this:
I get the error "Object is not set to an instance of an object".
Any suggestions on how I can fix this? -thanks
Hi,
How can I refer to an form in array of forms?
In my project, I have created an array of forms in a module like this:
Code:
Module FormsArray
Public ArrayOfForms(25) As clsDummyForm
Public Sub CreateFormsArray(ByVal i As Integer)
ArrayOfForms(i) = New clsDummyForm
End Sub
Public Sub CloseForms(ByVal i As Integer)
ArrayOfForms(i).Close()
End Sub
End Module
The problem occurs when I try to use the CloseForms() sub from another form like this:
Code:
Public Class Form1
Private Sub CloseAllForms()
For x As Integer = 1 To 25
CloseForms(x)
Next
End Sub
End Class
I get the error "Object is not set to an instance of an object".
Any suggestions on how I can fix this? -thanks
Last edited: