If I click Button1, form2 show, then I click Button2 I get.
"An unhandled exception of type 'System.NullRef erenceException ' occurred in
WindowsApplicat ion13.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim myfrom As New Form2
myfrom.Show()
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) 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.NullRef erenceException ' occurred in
WindowsApplicat ion13.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(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim myfrom As New Form2
myfrom.Show()
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click
Dim ff As Form2
Select Case ff.Visible
Case True
ff.Label1.Text = "This is form 2"
End Select
End Sub
Comment