How do you program a primitive password application?
Printable View
How do you program a primitive password application?
step1: create a form
step2: drop a textbox on it (further called textbox1)
step3: create a button (button1)
step4: write some code:
on button1.click event write this code:VB Code:
dim mypassword as string = "password" 'initialise the password variable (replace "password" with your desired password) ' then, on form1_load event : Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load textbox1.passwordchar = "*" end sub
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click if textbox1.text = mypassword then 'write here some code for the right password, example: msgbox("correct password") else 'write here some code for the wrong password, example: msgbox("incorrect password") end if end sub