VB中Form1中用户名和密码均正确后点击确定就进入到Form2,怎么编程?
PrivateSubForm_Load()Text1.MaxLength="8"Text2.MaxLength="6"Text2.PasswordChar="*"EndS...
Private Sub Form_Load()
Text1.MaxLength = "8"
Text2.MaxLength = "6"
Text2.PasswordChar = "*"
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
If Text2.Text <> "521121" Then
i = MsgBox("输入密码错误", vbRetryCancel + vbExclamation, "输入密码")
If i <> 8 Then
End
Else
Text2.Text = ""
Text2.SetFocus
End If
ElseIf Text1.Text <> "20092395" Then
MsgBox "用户名错误!", vbExclamation, "输入用户名"
If j <> 8 Then
End
Else
Text1.Text = ""
Text1.SetFocus
End If
End If
Form2.Show
Form1.Hide
End Sub
请高手们帮我改一下,进入不到Form2里 展开
Text1.MaxLength = "8"
Text2.MaxLength = "6"
Text2.PasswordChar = "*"
End Sub
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
If Text2.Text <> "521121" Then
i = MsgBox("输入密码错误", vbRetryCancel + vbExclamation, "输入密码")
If i <> 8 Then
End
Else
Text2.Text = ""
Text2.SetFocus
End If
ElseIf Text1.Text <> "20092395" Then
MsgBox "用户名错误!", vbExclamation, "输入用户名"
If j <> 8 Then
End
Else
Text1.Text = ""
Text1.SetFocus
End If
End If
Form2.Show
Form1.Hide
End Sub
请高手们帮我改一下,进入不到Form2里 展开
1个回答
展开全部
测试了一下,只要用户名和密码正确,可以进入Form2,程序有点小错,修改如下:
Private Sub Command1_Click()
Dim i As VbMsgBoxResult
If Text2.Text <> "521121" Then
i = MsgBox("输入密码错误", vbRetryCancel + vbExclamation, "输入密码")
If i <> vbRetry Then
End
Else
Text2.Text = ""
Text2.SetFocus
End If
ElseIf Text1.Text <> "20092395" Then
i = MsgBox("用户名错误!", vbRetryCancel + vbExclamation, "输入用户名")
If i <> vbRetry Then
End
Else
Text1.Text = ""
Text1.SetFocus
End If
End If
Form2.Show
Form1.Hide
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询