textbox的值为空或没有更改时,按下回车键textbox会失去焦点
此时用textbox1.setfocus不能使textbox1重新获取焦点
Private Sub Textbox1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbkeyreturn Then
KeyCode = 0
Textbox1.setfocus
End If
End Sub
时间: 2024-11-02 12:27:26
textbox的值为空或没有更改时,按下回车键textbox会失去焦点
此时用textbox1.setfocus不能使textbox1重新获取焦点
Private Sub Textbox1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbkeyreturn Then
KeyCode = 0
Textbox1.setfocus
End If
End Sub