在Textbox中按回车键后继续获取焦点

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

原文地址:https://www.cnblogs.com/lbnnbs/p/4785019.html