Private Sub txtNo_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then
If Len(txtNo.Text) = 6 Then SendKeys "{Tab}"
KeyAscii = 0
End IfEnd Sub
If Len(txtNo.Text) = 6 Then SendKeys "{Tab}"
KeyAscii = 0
End IfEnd Sub
从0 跳到2,我按照你的代码试了一下,根本不会响应Form_keydown,因为,Form根本没有得到焦点
如果你在txt1_keydown中这样写,则是完全Ok
"
至于按钮,由于不能在KeyDown事件中响应回车,你只有在Command1_Click 中SendKeys "{TAB}"
if keyascii=13 then
text2.setfocus
end if