此示例显示 Label 控件中当前选定的 Windows 窗体 TextBox 控件的名称。
示例
Private Sub TextBox_Leave(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles TextBox1.Leave, TextBox2.Leave, TextBox3.Leave Label1.Text = Me.ActiveControl.Name End Sub
编译代码
本示例需要:
- 一个 Windows 窗体。
- 名为 Label1 的 Label 控件。
- 名为 TextBox1、TextBox2 和 TextBox3 的三个 TextBox 控件。