mainit123
Technical User
- Jan 24, 2005
- 25
I have a main form that I use as a start point. Once a checkbox is checked, I successfully open a 2nd form on which is a button. Upon the user clicking that button, I am trying to open a 3rd form called NMember. On the button click action on the 2nd form, I have this code:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
NMember.ActiveForm.Enabled = True
NMember.ActiveForm.Activate()
NMember.ActiveForm.Visible = False
'Assume the next line will open the form but it throws an error
NMember.ActiveForm.ShowDialog()
NMember.ActiveForm.Close()
End Sub
But upon clicking the button, I get:
Object reference not set to an instance of an object.
So, it appears I am not truly creating an instance of the NMember form before I tell it to open. The NMember form does exist and up to this point has not been opened.
What am I missing to get this NMember form open upon clicking the button.
Thanks.
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
NMember.ActiveForm.Enabled = True
NMember.ActiveForm.Activate()
NMember.ActiveForm.Visible = False
'Assume the next line will open the form but it throws an error
NMember.ActiveForm.ShowDialog()
NMember.ActiveForm.Close()
End Sub
But upon clicking the button, I get:
Object reference not set to an instance of an object.
So, it appears I am not truly creating an instance of the NMember form before I tell it to open. The NMember form does exist and up to this point has not been opened.
What am I missing to get this NMember form open upon clicking the button.
Thanks.