帮忙做下VB登录问题

来源:百度知道 编辑:UC知道 时间:2024/06/24 00:07:11
要求鼠标能在"请输入用户姓名"后面的空格里,输入完成后用"回车健"自动转到下一空格里,输入完第二个空格用"回车健"就可自接进入程序了(等于点了"确定健",谢谢了

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command2_Click '确定的那个按钮的名称
End If
End Sub

在第一个TEXTBOX的keypress事件中
if KeyAscii=13 then
KeyAscii=0
第二个TEXTBOX.SetFocus
exit sub
end if

在第二个TEXTBOX的keypress事件中
if KeyAscii=13 then
KeyAscii=0
call 确定按钮_Click
exit sub
end if

Dim str As String
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()
Dim student As String
Dim i As Integer
Dim n As Integer
Dim cn As New ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=6C6CF07F486A42C"
If Text1.Text = "" Then