Public gdlyhstr As String '公共登录用户名变量
Private Sub Frmdl_Load()
Command3.Enabled = False '登录按钮不可用
Text1.Text = "" '输入框为空
Text2.Text = ""
End Sub
Private Sub Command1_Click()
Dim gyhmstr As String '公共用户名
Dim gmastr As String '密码
gyhmstr = "1"
'用户名变量
gmastr = "1" '密码变量
gdlyhstr = Text1.Text '公共登录用户名输入框
If Text1.Text = gyhmstr And Text2.Text = gmastr Then
Frmdl.Label1 = "欢迎" & Frmdl.gdlyhstr & "使用查询系统"
Label1.ForeColor = vbBlue
Frmdl.Caption = "欢迎登录"
Command3.Enabled = True
Else
MsgBox "请输入正确的用户名和密码", vbQuestion, "信息提示"
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End If
End Sub
Private Sub Command2_Click()
If MsgBox("您确定退出查询系统吗?", vbYesNo + vbInformation, "退出系统") = vbYes Then
Unload Frmdl
Exit Sub
ElseIf MsgBox("请重新输入用户名和密码", vbInformation, "重新登录") Then
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then '实现光标转移
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Command3.SetFocus
End If
End Sub
Private Sub Command3_Click()
Frmdl.Hide '切换窗体
Frmmain.Show
End Sub
这是所有的原来代码 请再给我看看 是否有问题