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