S
Simon Morris
If I click Button1, form2 show, then I click Button2 I get.
"An unhandled exception of type 'System.NullReferenceException' occurred in
WindowsApplication13.exe
Additional information: Object reference not set to an instance of an
object."
Why does ff = Nothing
Code on Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myfrom As New Form2
myfrom.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim ff As Form2
Select Case ff.Visible
Case True
ff.Label1.Text = "This is form 2"
End Select
End Sub
"An unhandled exception of type 'System.NullReferenceException' occurred in
WindowsApplication13.exe
Additional information: Object reference not set to an instance of an
object."
Why does ff = Nothing
Code on Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim myfrom As New Form2
myfrom.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim ff As Form2
Select Case ff.Visible
Case True
ff.Label1.Text = "This is form 2"
End Select
End Sub