Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do You NOT Hard-code in a Password form?

Status
Not open for further replies.

SteverZ

Technical User
Nov 8, 2000
16
0
0
US
I have a project where the main form opens with mostly grayed-out command buttons, which is perfect. To enable those buttons, the User clicks on the Password button and types in a password (no Username used, just a password). When the User has entered the correct password and clicks on the OK button, the Password form unloads and all of the disabled buttons are now enabled on the main form. All of this works fine through "hard-coding" the password. I have noticed though, that many do not think that hard-coding a password is a good idea. So how would I do my password without hard-coding. Also, I would be the Administrator since I am the creator of this project.

My Password form has one textbox for the password, a command button called OK and another command button called Cancel.

There will only be a dozen Users, so I don't need anything fancy or extensive. HELP! Thank You.
 
Hi!

You can store the passwords in a flat file or a database and retrieve the information in the form's load event.

hth
Jeff Bridgham
bridgham@purdue.edu
 
My suggestion ...

Create a program where the initial use of the program the password to use is prompted for, and then store the password in a random access file, being sure to require letters and a number or two in the password. Because of the way random files are written, if you use letters and numbers, when typing out the random file, you'll not be able to decipher the password.

You could also write a password to the registry as well. But I prefer the random access file because, for me, it's quicker and easier.

Additionally, I always hardcode a backdoor password for my use, just in case. Something really bland that doesn't look like a password.

Jim Null
Solutions by Jim Null
Web Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top