TabIndex依次排列 然后
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Text1(Index + 1).SetFocus
End If
End Sub
我要你给分。
不过楼上代码放错了位置
应该放在Form_KeyDown事件里
应该这样:
先排好TextBox的Tab顺序后在Load事件加这一句:Private Sub Form_Load()
Me.KeyPreview = True
End Sub
然后:Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{Tab}"
End If
End Sub
这样就可以啦,试试吧