Introduction

Many programs are password protected
and require the user to enter the correct password to get access to
the application.

Create an application
that asks the user to enter a password. It should be
masked with asterisks so bystanders cannot read the password on the
screen. When the user chooses OK, the program should check whether
the word entered is the correct password. If it is correct, the
application should display an appropriate welcome message in a message
box and then close. If the password is incorrect, it should display
a message asking the user to try again. The previous attempt should
be cleared and the cursor (focus) returned to the text box.

In addition, each wrong guess
should increment a counter. After five bad attempts, the program
should display a message telling the user that he or she has exceeded
the number of attempts and the program has been locked. The program
should then end.

Important features

  • Form appears in center of screen
  • Form is not resizable
  • Password is masked
  • Messages displayed using MsgBox
  • After incorrect guess, form resets for next entry
  • Counter only allows five attempts
  • Default and Cancel properties set appropriately
  • Proper indents, spacing, comments

Example