Tutorials Navigation
How To Make A Simple Login System C#
Tutorial Name: How To Make A Simple Login System C#
Category: PC Tutorials
Submitted By: Nissan
Date Added:
Comments: 3
Views: 6,514
Related Forum: PC Building Forum
Share:
Hi today i am making a tutorial on : How To Make A Simple Login System C#.
We are going to start off by making a form and adding the following items from the tool box to your form :
2 text boxes
1 button.
Once you have them double click on your button to get the event handler.
Now you will see some code and it will look like this :
[ Register or Signin to view external links. ]
Now go above the button handler and type the following :
internal void Login()
{
// this checks textbox 1 and textbox 2 are the correct login length for user name and password
if((textBox1.Text.Length <= 4) || (textBox2.Text.Length <=4))
{
//Tells the user that the user name or password is not the correct length
MessageBox.Show("Username or password is not the correct length","Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
//this is the username and password
if((textBox1.Text == "Admin")&& (textBox2.Text == "AdminPassword"))
{
//tells the user that there login details are correct
MessageBox.Show("Login information correct!")
}
else
{
//tells the user that there login details are not correct
MessageBox.Show("Incorrect Login Details\n Please try again")
}
}
So now your code will look like :
[ Register or Signin to view external links. ]
Now as you can see we have not done anything on the button yet so lets do that now.
In the button Event Handler we are going to use a try catch block and that code is :
try{ Login();}
catch(Exeption) { }
Now if you followed this tutorial correct your code will look like this :
[ Register or Signin to view external links. ]
Nope you learned something from this little simple tutorial .
Ratings
Comments
Related Tutorials
- 01. Emulating Xbox 360 on PC for Running COD4 With Mods(3,711)
- 02. How to: Matrix Numbers | Batch File(1,965)
- 03. How to Password Protect Files on Windows(875)
- 04. How to play Socom 2/3/ and Combined Assault on PC(6,942)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(6,291)
- 06. How to embed an image on TheTechGame(3,151)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(13,109)
- 08. Host bot lobbies! Full Tutorial!(11,684)
- 09. Unban yourself [Plutonium BO2](14,329)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(8,422)
- 11. Best Crosshair Settings for Valorant(6,566)
- 12. Othercide The Surgeon Boss Guide(2,579)
- 13. Othercide Remembrances Unlock Guide(4,530)
- 14. Othercide Beginners Tips and Tricks(2,747)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,901)
"How To Make A Simple Login System C#" :: Login/Create an Account :: 3 comments