Create Login Window With User Authentication in C# step by step

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi friends this is retrieval this tutorial I will teach c-sharp user authentication with username and password like based on the username password it will authenticate it like it's admin our user or client anything it will let me authenticate a now I will teach how to make that kind of project first of all I will create the one log in from just go to project and click at new window here and choosing the windows from here and just change in the name to form one to log in and click Add so you have to modify the size of your form as per aspera wish just go to the toolbox I am designing the login form right now just I will create one textbox and one label and one button so first of all I will modify the style of this those things first I have just modified the pattern child go to properties here change just login so I am changing the font size little bit as Pervis yes I am using SC u ua a irregular and 10 and okay now here I am changing the both label and font label and textbox okay now just hold your control key in your keyboard and just track it will copy your text box once again same thing I will just hold my control bar control button and a track sorry just a minute control set I will select only this button and a fold so I have two buttons here likewise I will copy so now I am changing his arranging those controls here so go to the text object we have to find it accepted here user name you're just I'm changing the password here exit I just I'm good at study single Hut it will underscore about the exit key it will look like good so now arranging my controls exit login and textbox a little bit bigger and username and password I am changing to varying the controls and giving the little bit space here okay now I successfully created the forms here now I will write the core just double click here exit so this dot flows I'm using this dot close so it will close the form and law in here I will write the code before that I will create system dot data dot yes Kuehl client so it will connect using system dot data so hi Here I am declaring to namespace here one is system da-da-da-da-da skill Klein it will using the SQL connections and SQL data adapters and SQL data readers and etc the main use of the skill data table it will storing the data table you want to use data table or data set but if you have to use the this system dot data here I already have created the one tip one database that database name is record inside the database I have two tables one is Tudor login and another one is student I hall ready previous tutorials I will teach how to create the logins login window sandali etcetera so you will see my previous videos in my login now I will teach how to create with login with user authentication so I have the table so how the table record is username is admin and password is a PA SS AHA now I need to create the user authentication so I will create one new columns here so just go to the table definitions mobile definition I will create the role one more column additional column here using the column data type is back cat so just and saving de Vaca so now will I will create the username so user one that is the username and password PA SS I'm using password so just a minute I will execute the record once again so it will appear in the role okay roll columns Here I am choosing admin so this first user is admin second user user - password same password PA SS but this is user or client I'm using flying okay so this is admin role this is the client role so now I will call the username and password so it will verify the username password first after that it will verify is the admin or client so based on the admin I will login to one from based on the client I will log into another form so now I will teach how to make that so so now now I will create the condition for that now I will create SQL data connection first a skilled SQL connection Co n equal to new SQL connection Co SQL data adapter is BA equal to new SQL data adapter and data table DT equal to new data table so I will declare three objects here now here declare the connection Singh just click the connections go to the properties just control a and control see your Phoenicians things inside your double quote have to face your connection Singh just how to put that sign before that he any slash anything it will all show the error okay now I will write the code here select now I will just call the roll here roll from from table name login the user name so I will check the column name here to check the column name examined plus text box 1.2 X step and and our third equal to so I think any mistake single quote double purpose plus double quote single quote single quote okay here text box to dot txt now here to put that connection st. cyr connections so it will won't show the hero this is s calculation s call data adapter here I will declare SD dot fill DT here I am using if DT got rose zero zero two string equal to Hel's okay here I'm just copy the record CEO just go to show data here HUD mean no I will change one more thing so just I am just calling DT dot Rho dot count equal to one then it will log in one form okay so this is our design sections go to this is okay now now I will create one MDI form your go to add new windows form RM day from you have to use any fonts here now I am here I'm using the MT I found just go to add new item here I am choosing the in click the windows form I am choosing the MD form MDF am want just and click Add em day form on here so I will delete all those things i know'd need this okay just and go to view code so I will delete all the previous items here no need this item sent out okay okay I'll just I put the save here now I will create one form file inside your file I will pray I will call bio-data so bio-data so double-click this bio-data I will create the even for here now we are just call that by data form so for you they thought any name any object equal to MU by your data here yes s dot t MDI parent equal to this why I am using MDI parent I will I will show I will show this letter so SS dot show just I'm calling the show patter now I hit the run before the read the button I will create the starting form is logging so I will say this starting from is this login form I will say the starting program just run the program once it will run the program here here I will type user user 1 and password the he SS and click login it won't work because I will didn't call that login but I didn't write the login button here so I will call the login button this m-day form here so I will call the MDI form MDI parent 1 equal to new MDI parent SS dot show now I hit the Run button so here I am type user one PA SS pause and click login it will run the AMD I found here so I need to hide this form automatically so once I successfully login I need to hide this login form so I will write the code also here just this dot height control X control we just put the save and run your program user one-p-p SS so it will successfully hide the farm now I am click the file click the bio-data C it will comes in yes afraid pawn so you will see the two forms here one and two so I need that form inside this MD parents that's why I am using this code which code I will show this dot this dot MDA parent equal to this so SS dot M different now I will click read the button now again click user one ESS and click login so I will click on my file and go to bio-data so now it's coming inside the parent farm now is act as your child form ok so now I need to now I need to show the pass the value this user is your admin user our admin user or client user now I need to pass the value so first of all I will create one form or create one label inside the inside this like inside this m-day form so first of all I need to add one label here so go to add one label here this is label and change that label say I label is status and and changing the font size little bit higher yes key UI font size ok this is my status now I'm hit the Run button one and click the Run button so I click login I will automatically store the this label should be enya admin user or under user so first I am going to the login form here I will write here I will write farm this farm md a parent dot controls controls label one dot text equal to DT dot rose Oh string so just and passing the values to that farm just save the farm and run program user one PA SS pause until plugin so it will showing the error right okay use one and he is his boss click login so object for reference so I need to pass this value to the particular form so I am changing mb8 so how to change little bit just hide this core now I'm going to the design section view code here I'm using string roll yes I am creating the string roll here Here I am setting label 1 dot text equal to roll and changing the roll options here now I am going to the login program Here I am changing just giving this value here copy and paste it here now I am save the project and click run the project here and click user 1 tab sorry PA SS pause and click login so now it will come senior admin so it successfully create the login to admin now I will log in like a client so user - Here I am putting putting that Vass pause until flogging so now it can see Nia client so first you have to store the values in but any label or anything in this empty a form so now I'm disabling this status so just go to the visible sections you have to click visible false so once I hit the Run button user one-click PA SS pause and click login so it will won't show that label here now I will click the bio-data button so I want to show you our login us here admin so I want to show any label you are login as admin like that I want to show so first I am going to the bio data sections so I will create one label here label sakes I am going to the form load event here I will write the code for that just I am calling that control X yes I am calling that code here I am calling the label one so I will pause that value into dot txt I will pass that value into label six so label six dot text equal to so plus I will add you you login us yes I'm adding this text also now I'm hit the program click user one tap sorry II a SS and click login so I am expanding this form now I am click file and go to click bio data now you are login as admin so based on this label you can hide or anything so we have admin section you want to hide any button or anything so I need to add mean only can delete this delete the options so I am click view button so I am viewing and click this icon so delete option is that so only admin can delete client know didn't delete so I want to create that options here based on this at me okay now just copy these sections gravity sections here equal to at mean just not equal to at me and this is inning we thought admin only delete so I need to this button delete button just go to the index of the delete button is button to just go to the V code here button to dot enable equal to false I am setting the button to us enable false now I am run the project and login user - and pas s pause and click login now I am go to file and click this bio data see now I am a client so this button is hidden it not accessible now I am close all the project and stop the project again I'm run the project as here admin user one PA SS pause and click login now I am expanding this form and click the bio data see now is visible because I am admin so the concept is first I will create a one form in one label in MDI form after that I hit done that form first I will create the login form I will once I enter the login form that admin are that I am storing that a role status in that label after that I every form I am reading that label once INSEAD mean I will pass on control once is client I will pass that control easier very easiest to pay to login with access control ok guys we will meet on next best tutorial
Info
Channel: Vetrivel D
Views: 595,019
Rating: undefined out of 5
Keywords: c# login windoe, c# user authentication, User, Login, Authentication (Website Category), step by step login window tutorials, c sharp tutorials, beggining with c#, c# begin, C# (Programming Language), learn c#, learn c sharp, check if admin, how to create login form in c#, make login form in c#, winforms, winform tutorials, c# programmers tutorials, beginner, c# project with database, c# projects step by step, how to learn c# for beginners, c# login form with sql database
Id: 6DB6_gStuOk
Channel Id: undefined
Length: 26min 48sec (1608 seconds)
Published: Mon Jun 01 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.