Create Simple Login Form in C#.NET Without Connecting to Database [With Source Code]
If you guyz are beginners in C#.NET, and you want to learn simple window form application with some controls like Textbox, Button, Label etc. change their properties and dragging and dropping these controls in your form, Then you are in the right tutorials.
First of all you need to have Visual Studio in your System, if you don’t have, Download it from here: Click Here
STEPS:
[sociallocker]
1. After installing this IDE, Open it and go to file from the menu of this IDE, Click new>new project, From the left side of your window, select Visual C#>Window and from the middle side select Windows Forms Application and then give the name of your project and then click ok which is shown in below.
2. From the ToolBox Drag and Drop two label, two Textbox and one button in your form and change the properties of these controls by selecting each control and right click that particular control and click on properties.
3. You need to change the label Text to username and password, TextBox Name to txtuser, txtpass or something like that so that it’s easy to remember during programming otherwise you may confused which textbox is associated with which label and change the Button name to btnlogin and Text to login.
4. Double click on the button and write the following piece of code:
string user, pass; user = txtUser.Text; pass = txtPass.Text; if(user=="admin"&& pass=="admin") { MessageBox.Show("successful"); } else { MessageBox.Show("error"); }
5. That’s it. This method of creating login window in C#.NET is called static method.
[/sociallocker]
if you want to create login window which is connected with your database then see these tutorials:
Login window using SQL Server Database: click here
Login window using MySQL Database:click here
If you are confused then you can watch the following video: