form1 has a label on it.
form2 has a button on it.
But I can't work out how to change the label's text via the button.
The code below doesn't work. It just says frm1 is not declared.
I looked on the net and it may have something to do with the scope of the variable.
But when I did this...
Public Class Form2
Public Shared frm1 As New form1
It still doesn't work. So what code am I missing? Thanks.
form2 has a button on it.
But I can't work out how to change the label's text via the button.
The code below doesn't work. It just says frm1 is not declared.
Code:
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
dim frm1 As New Form1
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
frm1.Label1.Text = "Text goes here"
End Sub
End Class
But when I did this...
Public Class Form2
Public Shared frm1 As New form1
It still doesn't work. So what code am I missing? Thanks.