username and password in forms
i am almost finished reading chapter 16 in this book and it is really helping me understand forms. But there is something that i want to add to maybe the simple editor example in chapter 17 example or one of the other form examples.
What i would like to add is a username and password field. I would also like to have the ability to create new user's and only if there is a valid use could they use the tools in the form.
What i have tried so far is putting in two text boxes called usernameTextBox and passwordTextBox. I also placed in two buttons one is login and the other is create new user. The login takes the text from the two boxes so that would be:
usernameTextBox.Text
and
passwordTextBox.Text
both of those are assigned to strings
i also added a .txt file to the project so i can place in the usernames and passwords. In the text file i separate the name and pass with a ";". I then have a global bool called validUser. It is set to true if the login was successful.
My success so far has been that after i place in one user and pass (not through create new user, but by editing the text file manually) it will login. My test for that includes a messagebox that pops up to notify if i have a valid user.
When it fails is adding a new user. So my question is a few parts i guess. Am I approaching this problem correctly? if not is there a easier way? Is it possible to place these fields in the simple editor example in chapter 17?
to any and all replies thanks
Last edited by csmhowitzer; April 3rd, 2009 at 08:00 PM..
|