Private Sub TEXT1_KeyPress(KeyAscii As Integer) if Keyascii=13 then Sendkeys "{TAB}" end sub
在Form中KeyPreview設為True,在 Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = vbKeyReturn Then KeyAscii = 0 SendKeys "{Tab}" End If End Sub 就不用在每個控件里寫了.
在每一个控件的KeyPress事件里加一句话。 if Keyascii=13 then Sendkeys "{TAB}"
if Keyascii=13 then Sendkeys "{TAB}"
end sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
SendKeys "{Tab}"
End If
End Sub
就不用在每個控件里寫了.
if Keyascii=13 then Sendkeys "{TAB}"