要求从控件 DTPicker1 中敲回车键能将焦点跳到下一个控件中。能将下列代码改好!
Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Next .SetFocus
End If
End Sub从其他的控件中都可以移到下一个控件中去(如Next中去)
有什么方法可行???
Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Next .SetFocus
End If
End Sub从其他的控件中都可以移到下一个控件中去(如Next中去)
有什么方法可行???
If KeyCode = 13 Then
Combo1.SetFocus
End If
End Sub其中,Combo1.SetFocus 也可用 SendKeys "{tab}" 代替,但要先设置好各个控件的TabIndex
SendKeys "{TAB}"
End If
'按向上箭头键上移
if keycode=vbkeyup then text1.setfocus
'按回车键或向下箭头键下移
if keycode=vbkeyreturn or keycode=vbkeydown then text3.setfocus
End Sub
SendKeys "{TAB}"
方法二:
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
XXX.SetFocus
End If
End Sub
这样根本不需要在每个控件的keypress事件里写代码,就可以实现回车把焦点转移到下一个控件。