一道vb编程题的源代码
展开全部
Private Sub Command1_Click()
Call login(Text1, Text2, Text3, Label4.Caption)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Label1.Caption = "用户名:"
Label2.Caption = "密 码:"
Label3.Caption = "附加码:"
Call fjm
Text1 = ""
Text2 = ""
Text2.PasswordChar = "*"
Text3 = ""
Command1.Caption = "提交"
Command2.Caption = "退出"
End Sub
Sub fjm()
Randomize
Label4.Caption = Int(Rnd(1) * 900 + 100)
End Sub
Private Sub Label4_Click()
Call fjm
End Sub
Sub login(str_name As String, str_pas As String, str_fjm As String, str_fjm1 As String)
If str_name = "" Then
MsgBox "用户名为空!"
Text1.SetFocus
Else
If str_pas = "" Then
MsgBox "密码为空!"
Text2.SetFocus
Else
If str_fjm = "" Then
MsgBox "附加码为空!"
Text3.SetFocus
Else
If str_name <> "test" Then
MsgBox "用户名错误!"
Else
If str_pas <> "test" Then
MsgBox "密码错误!"
Else
If str_fjm <> str_fjm1 Then
MsgBox "附加码错误"
Call fjm
Else
MsgBox "登录成功"
End If
End If
End If
End If
End If
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询