How to incorporate a password into my program

mracuraintegra used Ask the Experts™
Hey, I have a fairly simple question:
I have a program that runs batch files that change the registry; you click the 'Proxy on' (Command1) and it sets your proxy to a filtered server - you click 'Proxy Off' (Command2) and you no longer use that server. I have a TextBox (Text1).
I would like to know an easy way when you click each button to check and see if the password has been entered into the textbox. If so, then it goes ahead and runs the Shell ("c:\blahblahblah.bat"), but if the password is incorrect it does not run that line and pops a message up that informs me that the password is wrong. Any ideas?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
'1. in Form_Load()
    Text2.PasswordChar = "*"
'2. check password
    If Text2 = <password string> Then
        Shell ("c:\blahblahblah.bat")
        MsgBox "incorrect passowrd.", vbExclamation
    End IF

You have three options to this problem:
1. You have to store a password in Windows Registry and then retrieve it from there.

2. You can use a database like Access or SQL server to store a password and retrieve when required.

3. You can hard code a password in the VB form itself and check it from there.

Here is an example for hardcoded password:

Dim strPassword as String

Sub Form_Load()
Exit Sub

Sub Command1_Click()
  If text1="" then
    Msgbox "Please enter a Password"
    if text1<>strPassword then
      Msgbox "Password not correct"
      msgbox "Password Accepted"
    end if
  end if
Exit Sub


Direct and to the point. I now have a compiled program and it's ready to use. EXACTLY WHAT I NEEDED!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial