password protected application

speed

Member
Joined
Apr 4, 2007
Messages
7
Programming Experience
Beginner
hello...i need help...i tried to google but it did not help much...

firstly, i want to put a password to my application in vb.net. A standard password-protected application.

that is, when the user opened the application, it prompts (maybe by a inputbox) the user for password, if password is incorrect, the application will not load.

secondly, the same situation as above, but I want it to apply to button control in interface. It's like, when user click the 'Edit Details' button, it asks the user to insert password. If the password is invalid, the user cannot proceed.

Thanks in advance. Hope you guys can help me..
 
I'm fairly new to this as well, so there's prolly a more correct, or more simple way to do this... but this is what I would try first:

If you want a single password for the enire application before it loads, you can just use the input box to ask for the password onload. If it fails, then just do a Form1.Close()

if you want a password to be used as well, for other areas of the program, you should try making a seperate sub for it.

VB.NET:
public sub CheckPass()
Dim password as String
 
password = InputBox("Please enter password", "Password Required")
 
If password = "seasame" then
    'instructions to run
Else
Form1.Close()
 
End if
end sub

then all you need to do is add the line CheckPass() before any program function you want protected.
 
Last edited:
i would use the login form from this thread:
http://www.vbdotnetforums.com/showthread.php?t=3949

and check the username & password when the dialog closes before proceeding with the app's loading

you can also use that form everywhere else in the app where a password needs to be supplied too
 
Back
Top