软件白名单在哪里设置:vb最简单的问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/05 09:18:01
如何让VB中的窗口在运行中输完数字后回车就自动跳入下一格?例如在输入姓名后回车自动跳到性别格中??

共用三种
1.控件名.setfocus
说明返回一个控件的焦点
2.单击Command控键
创建一个text控键组
Private Sub Command1_Click()
Static a As Integer
Command1.Default = True
a = a + 1
If a < Text1.Count Then
Text1(a).SetFocus
Else
Text1(Text1.Count - 1).SetFocus
End If
End Sub
3.这效果就是你要的那种了
创建一个text控键组
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

If Index < Text1.Count - 1 And KeyCode = vbKeyReturn Then Text1(Index + 1).SetFocus

End Sub

把回车的焦点指数也写上就可以了。