vb里如何判断当前文本框是否获得了焦点

高手指教~
2024-12-23 04:18:40
推荐回答(3个)
回答1:

在FORM上 放两个文本框加入以下代码
Private Sub Text1_GotFocus()
Text1.Text = "获得焦点"
End Sub

Private Sub Text1_LostFocus()
Text1.Text = "失去焦点"
End Sub

Private Sub Text2_GotFocus()
Text2.Text = "获得焦点"
End Sub

Private Sub Text2_LostFocus()
Text2.Text = "失去焦点"
End Sub

回答2:

Private Sub Text1_GotFocus()
MsgBox "aaa"
End Sub

回答3:

你在两个文本框中,设置两个指针事件.