1个回答
展开全部
按 tab键.tabindex就是干这个的.
如果你想更细的控制,参考以下代码.
用方向键等键控制焦点在控件数组中移动.
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 6 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyDown And Index < 6 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyUp And Index > 0 Then Text1(Index - 1).SetFocus
If KeyCode = vbKeyReturn And Index = 6 Then Command1.SetFocus
End Sub
如果你想更细的控制,参考以下代码.
用方向键等键控制焦点在控件数组中移动.
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And Index < 6 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyDown And Index < 6 Then Text1(Index + 1).SetFocus
If KeyCode = vbKeyUp And Index > 0 Then Text1(Index - 1).SetFocus
If KeyCode = vbKeyReturn And Index = 6 Then Command1.SetFocus
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询