在文本框中输入密码,“验证密码”按钮检验输入的是否为“123456”。“清空”按钮清空文本框。“结束”按钮关闭窗体。
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim P$
P = Trim(TextBox1.Text)
If P = "123456" Then
Label2.Text = "密码正确"
Else
Label2.Text = "密码错误"
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
Label2.Text = ""
TextBox1.Focus()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Close()
End Sub
End Class