【VB.NET】窗体之间传值
Form1.vb的VB.Net代码:
Form2.vb的VB.Net代码:
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
本作品采用 知识共享署名-非商业性使用 2.5 中国大陆许可协议进行许可。 |