(vb)使鼠标一移到vb文本框中,就自动全部选定文本框中的文字

自动选中
2024-11-30 20:21:05
推荐回答(2个)
回答1:

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.SelStart = 0 '选中文本内容
Text1.SelLength = Len(Text1.Text)
End Sub这个答案没有错啊,为什么不关闭问题呢

回答2:

Private Sub txt_name_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txt_name.SelStart = 0 '选中文本内容
txt_name.SelLength = Len(txt_name.Text)
End Sub