Site hosted by Angelfire.com: Build your free website today!

Password

 

This is kind of like the secret number program but with a password instead. It should be fairly simple.

 

1.)   You’ll need two labels, two command buttons and a text box.

In the properties tool box you’ll find a ‘PasswordChar’ you want to change that to an asterisk (*)

 

2.)   The names are easy, you can chose what you want, I’m just going to put down what I’m going to use:

Name:                                     Caption:

LblMessage                               Type a password to log onto the computer

LblPassword                             Password

TxtPassword                             blank

CmdOK                                   OK    

CmdCancel                               Cancel

 

3.)   Type in the code:

The code for this one, as I stated previously, isn’t all that different from the secret number program:

 

         Private Sub cmdOK_Click()

                  Dim stringPassword As String

                  strPassword = txtPassword.Text

                 

                  If strPassword = “secret” Then

                           MsgBox “Password accepted”

                           Unload Me

                  Else

                           MsgBox “The password you entered is incorrect.”
                           txtPassword.Text = “”

                  End If

         End Sub

 

         Private Sub cmdCancel_Click()

                  Unload me

         End Sub

 

This should let the program work, if not you will have to check your spelling and grammar. Inside of the quotation marks you don’t need to worry about the spelling, except for the password, it would be hard to get the password if it was spelt wrong!

 

4.)   The final step of this is to play the program and make sure that it works.

 

 

The other thing that this program does is introduce you to str... As String. This says to the program that the word is a bunch of characters that make up a word that should stay as a word, not be translated into zeros and ones.

 

 

 

Back

 

Home

 

Case Study #1