Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
form2.Instance(Me)
form2.ShowDialog()
End sub
form2.Instance(Me)
form2.ShowDialog()
End sub
Form2.vb的VB.Net代码:
Private frm1 As Form1
Public Function Instance(ByVal frm As Form1)
frm1 = frm
End Function
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = frm1.Label1.Text
End sub
Public Function Instance(ByVal frm As Form1)
frm1 = frm
End Function
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = frm1.Label1.Text
End sub