此示例显示 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 控件。
本文介绍了一个VB.NET示例,演示了如何在Windows窗体应用程序中使用TextBox控件更改时更新Label控件的内容。当用户离开某个TextBox时,会触发事件,将当前活动控件的名称显示在Label上。
2942

被折叠的 条评论
为什么被折叠?



