' 在 InitializeComponent() 呼叫之後加入任何初始設定。
AddHandler TextBox1.Click, AddressOf TextBox_Click
AddHandler TextBox2.Click, AddressOf TextBox_Click
AddHandler TextBox3.Click, AddressOf TextBox_Click
End Sub
Private Sub TextBox_Click(sender As Object, e As System.EventArgs)
Dim frm As Form2 = New Form2()
frm.PassValue = DirectCast(sender, TextBox)
frm.Show()
End Sub
End Class
Public Class Form2
Private _passvalue As TextBox
Public WriteOnly Property PassValue As TextBox
Set(value As TextBox)
_passvalue = value
End Set
End Property
Sub New()
' 此為設計工具所需的呼叫。
InitializeComponent()
' 在 InitializeComponent() 呼叫之後加入任何初始設定。
AddHandler Button1.Click, AddressOf Button_Click
End Sub
Private Sub Button_Click(sender As System.Object, e As System.EventArgs)
_passvalue.Text &= "1"
End Sub
End Class