03-29-2003, 08:04 AM
Hello guys I want to create two forms. One is password and the other is the main form once the user enters the correct username and password. Im at the most basic level of this type of stuff so I have no clue about arrays or stuff like that, just plain basic password coding. If you see my image, I would like to program it so that after the user enters like 10 characters for Username and 6 characters for Password, all string, he can click on "Password Check" to advance to the next form. How can I do that? Any help is much much appreciated, thanks
03-29-2003, 08:06 AM
Change your text property PasswordChar to whatever you want ( deault is *)
03-29-2003, 09:54 AM
How can I code the command buttons (Password Check and Cancel)?
03-29-2003, 10:05 AM
ok im some what of a newb too.. but this will work if you dont have that many passwords yous can just use if statements :D not very productive but heres what im talkign about:
Private Sub Command1_Click()
If username.Text = "Cameron Moore" & Pass.Text = "MyPass" Then
ElseIf username.Text = "Cameron Moore" & Pass.Text <> "MyPass" Then
MsgBox "Invalid Password"
ElseIf username.Text = "Ben Moore" & Pass.Text = "Apass" Then
ElseIf username.Text = "Ben Moore" & Pass.Text <> "Apass" Then
MsgBox "Invalid Password"
This is the long way, im sure theres an easier way. Also If you add a new form one of them is log in, and it is a password check thing to try using it
03-29-2003, 10:07 AM
Ohh and for the cancel you probley just want it to exit? Do something like
Private Sub Cancel_Click()
All this does is exit the program when they press cancel. It's pretty straight forward
03-29-2003, 10:14 AM
Firstly, never use End. Unload all your forms and the program will terminate by itself. Using End forces the program to close without unloading objects, meaning they can linger in memory, not a nice thing.
Secondly, pnklphnts code above should use And instead of & to link conditions.
Lastly, you may wish to load usernames and passwords from a file (Open, Input, Close etc), database (ADO), or the registry (SaveSetting, GetSetting etc).
03-29-2003, 10:24 AM
is'nt there a set login form already made??? it might help you just click new form and click the login one then u just need to edit the interface and add the paswords into the code :)
HOPE IT HELPED :-)
03-29-2003, 10:27 AM
It looks to me like the form is already made, VBProgrammer... :-\
03-29-2003, 10:28 AM
yeah but he hasnt coded it yet has he???
* sorry if i miskaten " :huh:
03-29-2003, 12:19 PM
If txtuser.text = "User" then
If txtpass.text = "Password" then
'this happens when both are valid password and username
'this happens when just the password is invalid
'this happens when the username is invalid