Programming with Blessings! C# | Episode 1 | Advanced Login

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...

------------------------------------------------------------------------------------------------------------







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!
 

Naiwen

One and Only
25 July 2015
3,411
76

Reputation:

For which browsers? Any of them? I'm using Firefox at the moment, is it compatible with your code, @'Blessings'?
 

katos

Administrator
Admin
29 June 2015
2,361
76

Reputation:

Naiwen said:
For which browsers? Any of them? I'm using Firefox at the moment, is it compatible with your code, @'Blessings'?
 

Blessings

Junior
8 June 2016
37
0

Reputation:

Naiwen said:
For which browsers? Any of them? I'm using Firefox at the moment, is it compatible with your code, @'Blessings'?
It's a browser on the application, does not conflict with the current browser you are using right now. It has it's own built-in.
[hr]
katos said:
Naiwen said:
For which browsers? Any of them? I'm using Firefox at the moment, is it compatible with your code, @'Blessings'?
Glad I could help!
 

About Us

Forum Authority is a general discussion forum. We currently have a variety of categories to choose from, where you can participate in discussions. We also have many features such as a powerful credits & awards system, custom upgrades, plugins + more! Here you have the opportunity to meet new people, learn something new, find unique resources & tutorials, win contests & prizes, receive freebies and be given advice or help.

Top