Blessings
Junior
- 8 June 2016
- 37
- 0
Reputation:
First: We are going to add one button and two text boxes.
Next: I am going to right click the first textbox, scroll down to design and set its name as Username. Same with the second text box but with the design name password.
Finally: Double the click the button and enter the following code.
Basically what this code does is...
if (theCurrentTextInUsernameTextBox is EQUAL to "yourUsername" then show a message box saying success but...
if (theCurrentTextInUsernameTextBox is NOTEQUAL to (!=) "yourUsername" then show a message box saying failure...
Next: I am going to right click the first textbox, scroll down to design and set its name as Username. Same with the second text box but with the design name password.
Finally: Double the click the button and enter the following code.
Basically what this code does is...
if (theCurrentTextInUsernameTextBox is EQUAL to "yourUsername" then show a message box saying success but...
if (theCurrentTextInUsernameTextBox is NOTEQUAL to (!=) "yourUsername" then show a message box saying failure...
------------------------------------------------------------------------------------------------------------
Now hit Ctrl+Alt+L to open Solution Explorer and right click on the name of your project.
Now this is going to be the registration form!
So we are going to add 2 more textboxes and a button, now double click on the button!
Be sure to change the name of your textboxes under the design section userRegister and passRegister (you can use anything)
Now for the code of the button we are going to have it save your username and password in your Visual Studio settings...
First, go to
Now go back to the register button code and add this:
Now hit Ctrl+Alt+L again and double click on Program.cs and change the new Form1 to new Form2 (ONLY WHAT I CHANGE)
Now go to your form1 form and double click the form and add this:
//this hides the form off the bat..
Then go to the button code and change it to this: //What this does is it checks if the saved string under the Properties.Settings.Default.userNameText is equal to
Then double click the form2 and add this:
but declare
Finally add a button on Form1 login form and put the text as "Reset Account" and put the following code:
Done! So now if you click the reset account button, it won't automatically go to the login it will request you to register first..
TIP: If you want to have your form really look like a login form, right click the password text box, scroll down to PassChar and put * or anything you want!
Thanks for reading and I hope you have learned something from this lesson!