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,439
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(1,835)
- 02. How to: Matrix Numbers | Batch File(1,528)
- 03. How to Password Protect Files on Windows(749)
- 04. How to play Socom 2/3/ and Combined Assault on PC(4,912)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(4,916)
- 06. How to embed an image on TheTechGame(2,730)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(12,199)
- 08. Host bot lobbies! Full Tutorial!(9,281)
- 09. Unban yourself [Plutonium BO2](13,358)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(7,973)
- 11. Best Crosshair Settings for Valorant(6,112)
- 12. Othercide The Surgeon Boss Guide(2,183)
- 13. Othercide Remembrances Unlock Guide(3,858)
- 14. Othercide Beginners Tips and Tricks(2,399)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,282)
"How To Make A Simple Login System C#" :: Login/Create an Account :: 3 comments