VB中如何验证注册码-如果我在左侧汇出一个TextBox 在右边汇出 command1

来源:百度知道 编辑:UC知道 时间:2024/06/14 21:58:00
VB中如何验证注册码-如果我在左侧汇出一个TextBox 在右边汇出 command1 ,如果左侧输入的是正确的注册码则右侧显示正确 如果错误的···

Private Sub Form_Load()
Label1.Caption = "正确注册码:1234"
Text1.Text = ""
Command1.Visible = False
End Sub

Private Sub Text1_Change()
If Len(Text1.Text) < 4 Then Command1.Visible = False
If Len(Text1.Text) >= 4 Then
If Text1.Text <> "1234" Then
Command1.Visible = True
Command1.Caption = "输入错误"
Else
Command1.Visible = True
Command1.Caption = "输入正确"
End If
End If
End Sub