Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then SendKeys "{Tab}" End If End Sub
老哥,不一定下一个文本框就是一下tab键就可以移到的 说不定一堆text控件杂乱无章的……
to:jisheng(古朴的狼) 别乱赞人家,其实,唉
你的问题早有答案,100分去搜索一下吧!---- SandKeys
从text1跳到text2上 Private Sub text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then text2.SetFocus 可加入其他代码 End If End Sub
还是SendKeys好用!! 如果再加上 ReEnter(对Text)的话就更好了 '重新输入信息 Public Sub ReEnter(Control As Object) On Error Resume Next If Not IsObject(Control) Then Exit Sub With Control .SetFocus .SelStart = 0 .SelLength = Len(.Text) End With End Sub
If KeyCode = 13 Then
SendKeys "{Tab}"
End If
End Sub
说不定一堆text控件杂乱无章的……
别乱赞人家,其实,唉
Private Sub text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
text2.SetFocus
可加入其他代码
End If
End Sub
如果再加上
ReEnter(对Text)的话就更好了
'重新输入信息
Public Sub ReEnter(Control As Object)
On Error Resume Next
If Not IsObject(Control) Then Exit Sub
With Control
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub