Library Management System in Csharp (C#, Visual Studio, MsSQL Server) Complete Project(Step by Step)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to my youtube channel in this video i am going to show you a quick demo of library management system okay so i have started the project and here you can see this it's a login page for my library management system here you can see this we have this login button sign up button and these are few stuff which you can easily identify so this is youtube this is facebook and this is instagram when i click on this youtube logo this will open my youtube channel in my browser let me show you when i click on this i have clicked on this and it's loading okay so my internet connection is a little bit slow that's why it's taking a little bit of time so you can see this my channel is open that is btec days so if you have not subscribed to my youtube channel then please subscribe and to get updated with my new content as well and here let me show you that when i click on this instagram it will open my instagram account into my browser okay so it will move to the instagram account so you can see this if you have not followed me on instagram then just go and follow search for btec days as well and here you will find my account and then you can directly text me whatever problem you have and 24 into seven available there i'm going to resolve the problem so that's not an issue so let me move back to the project itself so you can see this so i have shown you what are these stuff and this is actually close i have designed this let me close this very basically this application is closed okay let me start this once again so here you can see this my username is lms and password is fast so let me enter this i have entered here when i click on login it will move to the dashboard here you can see this these are the features which i am providing with this library management system like books in books we have two stuff that is add new book view book in a student we have two stuff that is ad book view student book issue book we can issue the books we can return book complete booklet it will show how many books are allotted how many books are issued to the students and how many books are returned by the user okay so let me start with the first one so i have clicked on this box and when i click on this add new book here you can see this this form is open so if you need the source code then just you have to two step that is first subscribe to my youtube channel and second just comment your email id in the comment section i will provide you the source okay so we really do hard work for design new stuff new content and for that we need your support just subscribers this will help us to grow okay so let's start with this here you can see this now let me just name this book as java okay so book author name is something let me type jk okay here you can see this hook purchase daily let me change this to previous ones so uh it's in 2019 fab and something like this here you can see this cook prices 532 for each and how many quantities we are buying is 25 when you click on this save it will show it will ask you that are you confirmed you want to add this book so if you cancel that nothing will happen when you click on ok here you can see this the data is now added here you can see this data saved success success okay so when i cancel it will close up unsafely that will be related here you can see we have already saved and if you the without clicking on save if we click this then this will remove the data okay so let me move to this view book here you can see this we have this book viewable pk saying rk publication and witness day here you can see this 20 2019 532 and as well as when it is 25 okay so not to worry i'm going to show you how to design each stuff in this project okay so here you can see this we have to type book name if you want to search something like i have i want to so java or here you can see this when i enter the first character it search for java okay so when i click on refresh it will load all the data suppose i have written this publication or suppose i want i have purchased the 13 or 30 books okay but i have wrongly mentioned here 25 so i want to change this so i'll do that i've clicked on this here you can see this new form is opened here new panel is visible i'm going to show you how these stuff is working if i click on refresh the new panel is removed here if it's just nothing scroll bar is also removed so when you click on this row anywhere in this stroke now new panel is open with the filled data here because this four java pk saying here you can see this you can match the data actually peaking archive application witness day so you can see this everything is now visible here okay so i want to actually set this uh change this book pointing to 30 so here you can see this now 30 when you update this and data will be updated confirm okay so here you can see this now the data is 30. here you can see this okay if you want to delete any book you can easily delete with this button okay just click on that row data is here and you have to just click on delete data will predicted if you click on ok they will remove from the database as well and when you click on cancel nothing will happen here you can see this just cancel so you can see this we are back to here okay so let me just close this i've shown you how these stuff are working okay so you can see this everything is working fine now let me just move to this add student so let me add a student because we have to add a student because students are going to issue these books books as well okay so let me add some name that is puja and involvement number let me take pu dormant number is provided by the university so you don't have to worry about that enjoyment number okay so one zero zero two so i have added this number and department cse and semester fourth okay the contact number will be something like this okay and your id will i'm going to click on this save info data saved okay so i have not coded for this refresh when i click on this refresh all this text box will be cleared i will show you that not to worry if you are a beginner then just stay tuned with us watch each video i'm going to show you each small stuff how these gif i have added how these small stuff i have done and all these images and i can i will provide the link in the description for the all images and icons which i have used in this project okay so let me just exit here you can see this puja and this is what i have added here you can see this used to rent here you can see this puja you one double zero two and we have fewer students before okay so you can see that suppose we have entered something wrong with this you can actually search this uh here each record with this and all my number here you can see this pu when i enter pu there you can see this observe one is smallest of that this image is already changed when i enter something let me just remove all the stuff here you can see this new student now previous gif has been fixed so you can see this pu dash one zero zero two where i entered profile you can see this all this stuff is here when i click on this new form is visible here you can see this and suppose this uh she is from this fifth semester or like let me just take second semester okay so second when i click on update data will be updated confirmed oh so here you can see this it's now second and i want to remove this recorder as well so here you can see this is one two three four like this okay so i want to delete this data so how to delete this just click on this late delete data will be deleted click on ok now here you can see this now first record has been removed so this image is still here because this text fill text box is already filled with data let me just make this here you can see that okay so i have shown you how to do these stuff here you can see this now we have this issue book form okay so i have done one more change in this when you maximize this this text box are adapt according to that and these button moved from the right corner okay when you minimize it it will just change your size here you can see this how this stuff is going on i will show you okay so not to worry about that so here you can see this when i click on this book name here you can see this we have added java so this is actually fetch this data is faced from this uh database and being added into this combo box so i will show you that also not to worry about that okay so here you can see this what is going on okay so let me just start with this okay suppose you entered something wrong user id and password with uh sorry wrong enrollment number and when you try to search here you can see this invalid enrollment number so what we have entered is you dash one zero zero two which is puja and when you search you can see this puja cac second here you can see this all the data is here let me just refresh this here you can see this all the stuff has been removed okay so let me just close and add it so pu dash one zero zero two when i click on this search student here you can see this and suppose i have not selected this on any book here okay and when i click on this here you can see this select book here you can see this select book or maximum number of book has been issued it means that either you have not selected the book or this user id this enrollment number has issued with the three books okay so i'm going to enter spoken and let me just select this data structure this is the first book that i'm going to issue for this user writing okay so let me just issue book issue okay so i'm going to issue this another book as well so i'm going to issue java okay so i'm going to issue oops as well so issue and i'm going to again issue this data structure here you can see this i have already issued three books as well so when i'm going to try for the fourth book here you can see this okay so something error is there okay so there was a small error in my code so i haven't solved that and here you can see this uh we have already added issue three books for i'm now going to issue the fourth one okay so when i click on this here you can see this select book or the maximum number of books has been issued okay so let me close this and let me show you that when i click on this remove book here you can see this pu-1002 is the involvement number for this pooja okay so here you can see this we have already three books books allotted to her okay so here you can see this and let me show you once again that when i try to a lot one more viewed as one zero zero two and search student and then i select java um here you can see this now it's working fine okay so maximum three books can be issued to one student and when i click on free fresh it will remove all the content and when i click on this exit this will close this form okay so when i click on this return book here you can see this you have to search with the enrollment number okay so suppose a student has been come in front of you and you want to return the book so i'm going to ask what is your enrollment number and when we say zero zero two and when you search for student here you can see this if suppose if the user want to return this uh java or data structure book okay so i want to return this java book when i click on this you can see this all the data is here and i want to return this so when you click on this return this will return the book okay so when you click on this return here you can still return successful when you click on ok and if you again search for view dash one zero zero two here you can see this we have only two books here and if you want to reissue the book now user can access that book one once again okay so pu dash 1 0002 and when i click on this here you can see this now i want to take one oops one more book okay so when i go into issue book here you can see that book should let me just close this and when i click on this you dash 1002 search and if you want to if you want more book here you can see this book has been okay so i'm going to show you that the third book is available or not let me see this now we have two books book is here okay so i have shown you how these all stuff is working you can see this you can select the return date like in fast or something like that you can change as well so return okay so i have shown you how to do this when you click on this exit this will close the application close the form as well and let me just show you [Music] when you click on refresh it will remove all content as well so just close this and let me show you what is this complete detail when i click on this you can see these are the book currently allocated to the users okay so you can see this all these contents are here it showed book currently active here you can see this three books which are issued okay so which is puja puja puja okay so two books currently okay so you can see these two books and all the return book are here which i have practiced for when i'm designing this application okay not to worry about that so i'm going to show you each stuff and each image is an icon i will show you i will provide you not to worry about that okay so let me just see one of the small stuff you dash one zero two here you can see this and the same way you can return more books okay so when you click on this exit this will close the application so i hope you like this project and if you really like this project just stay tuned with us have a good i'm going to show you each stuff just stay tuned tomorrow i'm going to update the first video for this how to design the login page as well and how to design this dashboard and after that how to design one book at book view book as a student view student show book return book complete with detail exit everything in detail okay so not to worry about that so that's it for the today's video thanks for watching please subscribe to my youtube channel and please follow us on instagram just go and for more similar project just put description you can check for other projects as well thanks for watching hello everyone welcome to my youtube channel in this video i am going to show you how to design this login form and how to back in code of this logic and i will show you how how to go for this um youtube when i click on this this will let me move to my youtube channel the same when i click on this to my instagram account i will show you how to design this everything in detail okay so just stadium and be focused so let me just start this so i have already created a new project here you can see this so this is the form so first let me just copy the size of this form so that it looks similar okay so here we go with this and let me just copy the size of this form okay so just go to properties and here you will find the size here you can see this you just paste this here you can see this we have the size okay so what we need is first thing we need to actually remove this uh border so for that you have to just change this here you can see this let me just first thing you have to change this start position to center screen when you start this needs to be shown into the center of the screen okay so after that you have to change a few more stuff that is form border style size label so you have to change that to none here you can see this we have now this i uh border has been removed and after that we have to set the color so for that you have to just go for fall color and in this let me just copy the color code as well so for that just click on this and let me just copy the color background color that is this one 35 36 and 55 that is the color combination and i have to just okay sorry that's not so we have to change the background color pack color that is here you can see this just paste this here you can see this now it's looking nice after that in this you can see this we have this picture here so i need a picture box and this is also a gif so i will provide you these images icons into the description just go and check out the video description these are all labels as well so i will provide you all this stuff okay so let me just drag one picture box so in the toolbox you can search picture box here i have in this picture box let me set the image so choose image which will select it will open your local directories and that you can search for images okay so in desktop i have folder that is login icon and this i have used updated this one i've used this one so okay and hit ok just set this one to stretch image and here you can see this okay so this is same in the previous and we need one more picture box so let me just drag and drop one more so and this you can see this there is a small rectangle shape that is just bouncing so that it's look nice so let me just add that to just choose image and this local resources click on import and it will select the image so this one is box loading okay and just select the stretch okay so we have to make it large so that it look nice and put this box on the proper place here now let me start this so let's see that it's on the right place or not so i can see this it's not applied on right place you have to move it on the right position so make it little bit large okay so bring this to front just right click and bring to front there you can see this now it's looking nice just to start this here you can see this now it's looking nice okay so in this way it's working let me just move it to a little bit upside now we need two text boxes so just search for text box drag and drop i need to just copy and paste so we have to now here just make it large first after that i will show you how the other things are there so after this you have to do one more thing that is first we have to set picture box that is icon two icons and other pictures box let me just choose so for user name we have this one open this okay just stretch image and here you can see this we have this here so here we have this copy and paste one more time just bring it in this front and change the image password is this one open click on ok now we have set and after that in this you can see we have two lines here this is nothing but this is a border this is a panel actually okay so let me just drag one panel okay so here you can see this we have this panel here and let me just make it off this side let me just increase the text box guys so here we have this panel now so we have to set this panel color to white okay so background color to white here you can see this decrease its wealth okay so how to do that for that you have to just go to this size here you can see this we have this 10 to 5 hit enter here the size is decreased four okay so just copy and paste one more time you have to copy this panel and paste one more time and just drag it here okay this way you have to do and after that here you can see that this text box is visible so how to remove this uh white space white color from the background so for that you have to just click on this border and copy the color combination the back color and just set this back color for this text box okay so search for back color and just paste it and hit enter you can see this but you can see small white rectangle shapes let me just start this this will visible here you can see this the white space is still white border is visible so let me remove that white water so for that how to move that here you can see this border style fixed 3d so let me just remove this to set that here you can see this now start this and you will find that nothing is there here you can see this you can write it something that's in the black color so we will change the color as well so this is quite large so let me just change it size to one okay and move it a little upside and just start this okay so now it's nice but i want this uh text needs to be in white color so for that just click on this text box and search for fall color and just set this to white after that you have to change the font of this text box so click on this three dots on font and after that select gallery and in this hold 10 okay here you can see this just start this and you will see the difference here you can see this now it's clearly visible and this you can write anything and it's in white color okay let me just stop this and the size is little bit smaller so let me just change increase the size font okay so let me say 12 okay so now it will be nice in the same way we have to change this uh panel width as well so here we have the set hit enter and we have to move it a little bit and just change this color background color here you can see this back color paste 35 36 and 55 hit enter remove the border style to none and change the font as well so just change the form for color to white after that click on font 12 and calibrate and hit on ok you can see this now start this and you will see the difference here you can see this okay so everything is nice now but here you can see this in this form we have buttons as well and this is another button so let me just drag two buttons so i need button drag and drop it copy and paste to replicate and after that make this button large i've just copied and pasted it once again let me make it a little bit larger okay so let me change this button text to login and let me increase the font well and change the color so background color needs to be this one okay so you can see this a little bit white border type is visible so we have to change for that too so for that you have to just change little bit small stuff that it is let me just search so we have to change this let me search flat style here you can see this we have to change this to pop up when you select pop up here you can see this the border white border is removed let me just start and show you now when i click on this you can see it's look like 3d button which is being clicked and here when i click on this nothing happens okay so in the same way we have to change for this one too so let me just increase the size to 12 bold and set sign up hit enter login make it old too okay and make this little bit dark color so just change this background color back color this button to like this grey here you can see this but we have to change the style flat style just change this to pop up here you can see this now it's looking nice we have to change this color the four color that is button color to [Music] let me just select for color too one okay so now it's looking nice and after that in this you can see we have um these logo as well so i'm going to add these logo so for that i need picture box search for picture box just drag and drop it here just decrease it size like this choose image click on import and we have to select first thing is what instagram so okay and make it stretch after that we need three similar so just copy and paste two more time and set different images here you can see this then click on this choose image click on import and we need facebook and we need you so just click on this click on import and youtube let me just start this you can see everything is now fine looking nice and you can see this we have this logo as well so we need one button here first thing what we need is button so add button just drag and drop it here just change this to so i'm using capital x closed okay so let me make this smaller after that we have to change the color so change the back color to like this and change this flat style to pop pop up after that change this for color to red so that that's visible okay so after that we need to actually increase the size so that x is clearly visible like 16 okay but it's nice okay so we have this button now okay so let me just change the design name of this button just go to properties and change this to close hit enter and when you double click on this this will generate a click event and you have to write just this dot close see this and start this now we have this button here click on this here you can see this it has been closed okay after that here you can see this we have this text box in this text box we have some text username and password so how to set that for that just click on this go to properties and text you have to write user name and in this we have to type password and what we have to do is it is a little bit different so we have to make the change in font as well so make this too bold okay so now you can see this the difference now what are the problem is i have set the text here but here you can see this it shows like we have this text we have to delete this and after that we have to enter the username or password so how to do that for that we have to just go to properties of this text box and here you can see this this event click on this and search for mouse enter there you can see this you will find this click on this so first xbox name is text box one so let me first change the text box name as well so let me just remove this event for now so event has been removed after that just go to properties and change the name design name that is txt password sorry txt user name and for the second one you have to set txt password okay after that we have to generate the event that is mouse enter here double click on this extrusion center event is generated and here what we have to do is when this mouse is clicked on this text box this username needs to be removed that that means that this text box needs to be empty so how to do that for that you have to check that if in this text box only username is written if pxt username dot text is equal equal to username and what we have to do is dxt username dot here we have to do this okay so let me just start this one again and when i click on this here you can see this the text is already clear okay so we have one small issue we have used the strong event so mouse enter when you drag your mouse there it will clean up but what i want is when i click on that so for that mouse click we have to search for mouse click you can see this mouse click just double click on this and just cut it use this one here and start this you will find that when i click on this this text box is empty then i write something and when i again click on this this is uh still we have text how this is going on because i'm checking that if text box username dot text is equal to is equal to username then only when i click this text box let me just write this username and when i click on this and when i again click on this it will empty this the same way we have to do for this second text box so just go to this text box and search for mouse click you can see this the same way we have to do check that in the second text box we have pretend password text is equal to password and this we have to clear the text box and one more stuff what we want is that when i click on this it's here i get right when i click on this it's not clear why because i have written strong spelling here okay so it's w so when i start on this and when i click on this here you can see this but one problem is that when i enter something in password it is clearly visible so we have to change this passcad type for that txt password dot pass cap is equal we have to mention this star like this okay now when you start this and you write something in there so you can see this but when you write something in this it will be in this star format and it will be clear let's just copy this and paste this so you can see this like this okay so i have shown you how this stuff is working so now i'm going to show you how this button when i click on this login how this data is going to validate from the database okay so i'm going to show you that and before that i will show you how to code for this youtube picture box and for facebook logo and other stuff okay so let me just show you so when i click on what i need is when i click on this youtube we move to the studio okay so for that we have to just double click on this to generate a click event for picture box seven click everything generated it says picture box seven that's right let me just remove this and change the name of this picture box so just go to properties and let me just change this name to picture box youtube and after that picture box facebook after that picture box and stuff okay just double click on this picture box youtube link is generated in this you have to write just you have to write system dot diagnostics dot process dot start and in this you have to just enter your actually the url where you want to go so let me just copy the url from this complete project just double click on this let me just copy this there is a youtube url here you can see it just copy this and it is this okay so when i click on this and i will click on this this will let me move to the youtube channel so let me just click on this i have clicked here you can see this it's processing so it will take a little bit of time but my internal connection is a little bit slow okay so my internet connection is actually disconnected but i'm showing you that that this is working here my browser is opened and let me move to the youtube.com channel okay so i will show this later so in the same way you have to do for the rest just double click on this and you have to do the same stuff you double click on this event is generated just copy the url okay let me just copy this from this one so this is facebook facebook and this one for insta copy this one just save this okay so now we have done with this but now what i want is when i click on this login we have to validate the data from the database and after that we move to the new form before that you have to just change the name so let me just change this to ptn login just double click on this to generate a click event now button login keep it in generated here you can see this after that what i need is first start that is what we have to create a table into the database so here you can see this we have created a table create table login table id and it's a auto increment primary key so we have to only insert these two stuff that is username and pass so i have inserted it here insert into login table username password these are the um column name here you can see this and the values is predicted and pass so one record is inserted into this so let me just show you quickly select start from login table and when i execute this we will find that we have only one record here which the name is predicted and pass okay so i have created this table you would have to just execute this query into your database just pause the video just write this and export this let me just move to the project okay so you can see this so first what we have to do is we have to make sql connection first so sql right connection so when you write this you will find one small pop-up here you can see this we have to use using system data dot sql client this is the library we have to improve to use the sql database okay so here you can see this this is included automatically when i click on that the color of this text is also changed after this we have to create an object for sql connection and after this stuff that is connection and sql connection after this we have to pass a connection string in this just right on dot connection string and after that in this double quotes we have to write data source that is data source and this you have to copy this stuff from your actually with microsoft sql server management studio you have to just click on this file connect object and you will find this stuff just copy this copy and just paste this here and you have to include one more slash here otherwise show error and after writing this you have to mention the database name my database says library and after that you have to write integrated security make sure these capital let me just show you here you can see this i have selected this library in the library uh we have this table that has logic table okay after this what we have to do is we have to make object for sql command and on this we have to write the cmd equals new sql command and after this cmd dot connection we have to pass the connection that is gone the connection object that is here you can see this and after this what we have to do is we have to pass the connection sorry command text command text what is the command text okay so i want to select all the data which is in the database whose username and password is matched here you can see this so select star from table name is login table and then this where we have to check the condition where user name this is the column name username is the column name here you can see this username my table name is login and t in capitalize and table so let me just write it here username equals and it's a string type so we have to use like this first single and after double fill then double plus then double quotes then single quotes and within this we have to write the txt username dot text what we have to match is username what user has entered into this first text box okay so i'm going to match that with the database okay so after this and we have to also match the password so we have to write and pass that is column name in the same way we have to do single quotes and within that two double quotes and two plus within that plus you have to write this txt password dot text okay and this is the closing port okay here you can see this now we are done with this after that what data has been returned needs to be stored somewhere so where we have to store the data set so we are going to store that into the data set before that we have to uh create an object for sql data adapter [Music] and in this we have to pass the command and after that we have to create object for data set yes it [Music] and this data set needs to be filled with this pa data adapter so ta dot fill yes that is data okay so now i'm going to just write this and to add a breakpoint i've added a breakpoint here to show you that when i enter bt days and when i enter pass then this data set contains some data or not okay so let me just execute this click on this and i'm gonna enter pass when i click on this here we move here this is breakpoint so if our program execution is paused and in the data set when you hover mouse on this ts and you can find this smartphone fast glass when you click on this here you can see this we have this data because we have entered valid username and valid password let me just enter some wrong username and password okay so let me just enter something when i click on this but we will find that the data said we have nothing okay so our code is working fine database is fetching data okay so from database the data is being fetched okay so now what we have to do is we have to check one condition that is if ds ds dot tables and we have only one table so that is zero dot rows dot count is not equal to zero then what we want to do is we want to move to new form and in else condition if this data set is empty what it means that we have wrong introduce a wrong user id and password so for that message box dot show wrong username and or sorry or password and this message box needs to be named with some that is error this contains some button so message box dot okay we try okay so let me just enter okay after that this message box needs some icon so message box dot i can dot error okay so now let me start this and when i enter this wrong username and password when i enter valid username that is when i click on this nothing is happening that this is a valid username and password so let me just add one new form quickly so that i can show you just click on right click on this add windows form so dashboard hit enter so what i need is when this valid uh the database the username and password is valid we need to move to this dashboard so how to do that for that first object for the dashboard and what i want is dh dot show and one more stop first what we want to hide this form so this dot height so when i click on login and the unm and password is valid then this will okay so this is showing error because data set is also ds so dsa let me just type okay so now when you save this now it's probably good this is all right when this username and password is valid then login form will be hidden and this form dashboard will be visible so let me start this let me enter some wrong user id and password post and when i click on this raw generating password so let me just enter i'm going to click on this and just write when i click on this here you can see this this is um plugin form is here and this dashboard is facebook okay so let me just quickly add one more record into the database so so that you can see this is working or not let me just remove this and let me add travel and password is passed just execute this control expected it means the data is inserted so let me just exclude this travel and pass so let me just start this one up once again after that toggle and then this pass here you can see this it's working okay so we these west one small stop that is you can clearly see the difference in this one so we have a small uh actually rectangle shape or this is the rectangular shaper you can see this the sky color so let me just add this one to this one too okay so how to do that let's just first stop this after that we have to search for rectangular shaper just drag and drop it here okay so we have to change the color so back color to so we don't don't need to change the background we have to change the fill color just go okay okay actually we have to change the back color okay so just click on this so something is wrong with this let me just check fill color changes to custom and this one actually we have to change this uh text color here you can see this this for color just click on this add select this okay so it will work now so we have to change this border color so just select this one to custom and just click here you can see this and we have to increase its width so we have to change this to three here you can see this now it's nice and let me just drag this to proper position okay so we have it here after that just make it large like this now it's looking nice when i start this so here you can see this is the border here so this button is upside so let me just move this little bit in okay let me just adjust this let me just start once again so now here you can see this everything is fine so that's it for today's video guys thanks for watching just stay tuned for more videos and just subscribe and hit the bell icon so that you can get updated with our new content thanks for watching hello everyone welcome to my youtube channel in previous video i have shown you how to design this login page and how to bracket code how to back-end code for this form okay so let me just move to the dashboard so my username is big days and password is pass if you are not watching this video you can just go to description there i have put the link for the previous video and click on login take a little bit of time and here we have this dashboard okay so in this video i'm going to show you how to design this dashboard and how to add these buttons and these images as well so i'm going to show you this so let's start with this let me just close this and actually we are working with this one every video here you can see this so i have already created a form added a form into this that is dashboard okay so you can just do like this just right click on this click add and just windows form okay so when you do that the new form will be created okay so here you can see this we have this form let me just make it large here you can see this you can see one smaller stuff is here that let me just show you that here this is what this is a menu strip so we have to add one menu strip so let me add just drag and drop it here you can see this here we have the menu strip and here we have few text here you can see this we have to add text here as well so let me add text so first is books and within that there is add new book and the second one is view book okay so you can see this when i click on this add new book and your book is here so i have added that in this student we have to add a student and view student information so we have to add that too so here you have to click student and in this you have to write two stuff that is add student and the second one is view student detail or info okay after that what we have is issue book after that we have return book after that we have complete book details and finally we have exit okay so we have now burns let me just start this so when i start this it will open a login form and when i enter a valid user id and password after that will move to the dashboard so before going further i will change the load form okay okay so it's lately it's taking a little bit of time so you can see this we have this that is okay so when i click on this it will let you move here you can see this easy stuff right here okay so let me just change for a smaller stop that is what when i click on start i want to directly load this dashboard in place of that login form so just go to this program.cs and just change this form 1 2 dashboard okay so when you execute this now directly dashboard will be open here you can see this no login form is there so when our projector will be completed then we will change this to form one okay so that's not to worry okay so here we have this but here you can see one small stuff is that it's a background image so how to set the background image just click on properties image search for image okay you can see this background image click on this i will provide you each icon and wallpaper i'm using in this just check out my description there i will put the link for all images i am going to use into this and all icons i am using okay so not to worry just stay tuned and be with us and if you are not subscribed to my youtube channel then please subscribe and hit the bell icon okay so let me add images okay so here i have all the image which i am using so this image i am using so click on ok and click on ok here you can see this we have it image here so what i want is not to tie but stretch okay so when i start you observe that the image is set now but i need one small stop that when it loads it needs to be full screen and it's in the center so how to do that for that you have to just go to proportion and you have to change the windows state to normal to change this to maximized and when you start this you will observe that this will open in full screen you can see this now it's nice looking nice okay so after this what we have to do is we have to actually remove this uh border here you can see this this i don't want this here you can see this this is a complete budget here you can see this there is no border frame okay so i'm going to remove that so how to remove that just go to properties and search for uh frame okay so search for uh form border styles let's change this to none here you can see this we have now none but i'm not going to start this because if i start i can't able to close because i have not coded for this exit as well so let me just change this to for now to fix 3d and finally at last i'm going to remove this okay so now what i want is i want to set that icon for this search so how to do that just click on this and right click and go to properties in properties you have to set the image okay so search for image here you will find this image just click on this local resource it will open your local computer files and after that you have to select the image whatever you want i have used these images in this project i have stored this at a one place so that i can use easily i will provide you each of this i have already told you that so first image what i have used is books is this one so i'm going to open it and hit okay here you can see this it's looking quite small so how to make it large just change this image scaling size to fit here you can see that it's sized to fit just change this to none here you can see this now it's quite large the same way you have to do for this add new book click on this add new book just go to properties in properties you have to add image that is select image click on this local resource import and in this we have to find the image that is this one add new book open open and you have to change this image scaling to then here you can see this now it's looking nice in the same way you have to do for the second one that is view book just right click go to properties select the image here you can see this just click on this local resource click on this after that we have view book so view book images let me just search here you can see this one okay so hit ok after that change this to none okay so now here you can see this it's looking nice in the same way we have to change for this student as well so for student we have to just go to properties here you can see this it's already open so search for image here you can see this just click on this local resource import and select the student where it is this one okay change this to none add student click on image local resource import after that you have to search for this one [Music] after that you have to click on this view so that info just right click go to properties and this as well search for image as you can see this now it's looking nice the same way we have to change for this issue search image click on this local resource issue book so we have to use this change this image scaling to none return book select this image local resource and after that we have to use this return book logo where it is let me just find this one okay face to face okay so complete book data in complete book detail we have to use the first logo so let me just show you so we have to search for image here local resources so this is if we find this complete book open open this changes scaling to none and after that this finally this we have exit so we have to click on this image local source click on import and accept logos where it is let me just search for it here because open click on change okay so here we have done this task let me just show you here you can see this we have all this stuff added here so now we have to do one more stuff that is i want to change the color of this manual strip here you can see this you observe that this color is little bit different and each second button the color is also different so let me just change the color so let me just copy the color code so here back color is beat so let me just copy this one and let me just move to here here you have to do that click on this empty space okay here it is in this corner and right click and go to properties here you can see this manuscript one make sure you're changing the color for the menu strip one after that you have to just go to back color here it is you have to just write w capital tweet and hit enter it will change the color here you can see this the color is changed and how to change the color of the second button so we have to just select this cd rl and click on this like this and you have to go to properties and this you have to change the back color as well okay just right click and go to properties and here let me just copy the color code of this one so this back color is old and ace let me just copy this and let me just add this here back color and hit enter the color will be changed here you can see this the color is different from these two in the same way change for the rest of two back color to here you can see this shouldn't look fancy after that change power one two okay so here you can see this now let me start this okay so you can see this now it's looking nice so we left with few stuff that is i have to code for this exit button when i click on this the application needs to be closed and i have to remove this frame so i have already shown you how to remove this frame but i have shown you i have not shown you how to go for this exit button so to generate a click event for this exit button just double click on this to generate a click event so i have double click on this and what i want is when i click on this i want to close the application so application dot exit will close the application but what i want is when you just click on this that it should not directly close the application it should ask the user that you want to exit or not so for that you have to code like this if message box dot show it will show it meshes are you sure you want to accept and the message box name will be confirmed okay and after that i want buttons in for this message box for message box border dot i want yes or no and i want few icons that is message box i can talk warning because it's a warning and after that i will check that which current user has entered so when user enter yes when user enter on click when you click on yes i want to exit the application so let me just check dialog result dot yes then this is yes this code needs to be excluded which is within the skip condition so just cut this and paste it here let me start this once again when i click on this are you sure you want to exit if you click on no nothing will happen when you click on yes this will close the application okay so the task is done one more stuff is left what is that i want to just remove this style so just remove this okay so you have to change this form borders type to none so just save this and let me just start this and you will find that now the application is opened in full screen and you can you can see here there is no border and when i click on this it will last and when i click yes it will close the application so that's it for today's video guys uh stay tuned and just subscribe to my youtube channel in next video i'm going to show you how to design uh for this add new button let me just show you that quickly so this is a complete project and let me just start this and just type and let me just type the password that is pass and then i click on this will load the next video i'm going to show you how to design this and how to back in code for this one okay so just stay tuned and stay focused for previous videos and for next videos just go and check the description thanks for watching hello everyone welcome to my youtube channel as you all know that we are working with library management system in previous video i have shown you how to design this dashboard and how to add these images and how to change the color of these buttons here you can see this and how to add the icons here you can see this okay so i have shown you all these stuff in the previous video you have not watched my previous video then just go to the description where you will find the link for the previous video just click on that and watch my previous video okay so in this video i'm going to show you how to design this add new form here you can see this when i click on this add new form this form is open so in this video i'm going to show you how to design it like this okay so let's start with this let me just move to this one that's it login video here we are working with this one okay so first thing what we have to do is we have to add one form so for that you have to just right click on this login video sorry library video and click on this add and after that you have to just click windows form okay after that you have to do is when you click on this pop-up will be there that is this one and after that you have to write one small stuff that is what the name of this form that is add book i have written it you can write that as per your requirement so add book and hit enter so here the form will be added so let me just copy the size of this form from this one okay so here we have now right click on this and just let me just copy the size of this one okay so let me just right click click and go to before is and there you will find the size okay search for the size here we have 300 by default just change this to 700 comma 467 and hit enter you can see this after that what we have is here you can see this we have one image panel this one is panel label this is a picture box this is also a picture box and this is it another panel so how to do that for that let me just add one picture box and panel first so picture box just copy and paste it and this just click on this click choose images local resources click on this and here this image i have used motivation one so just click on this okay stretch image and after that you have to just feel like this okay you can see this after that you have to do one more stuff that is you have to add one panel let me just drag panel here so here we have this panel we have to set it like this okay let me just copy the size of this panel this one [Music] google is 660 675 and 77 so just go to properties just paste it here hit enter let's decrease the size okay so after that we have to add one more panel here so that we can change the color let me set the color for this panel as well so let me just copy the color code so here we will find this back color is feet just copy this one and set here this properties let me just select this back color and after that you have to write feet and hit okay here you can see that the color image has changed the background color change after that we need one more form for the panel so let me just drag it and drop it here you can see this just make it like this you have to make it large just go to properties and select the color from here this one is the color code 255 comma 192 comma 128 so we have to paste the back color here okay so you can see this the color has been changed so after that let me just copy the size of this panel as well so here you can see this it's a location actually so here is the size 419 and 348 so i have copied the size this is location so here we have this okay so now it's looking nice okay after that here you can see this we have this image and we have this level okay so let me just add one picture box so search for picture box and drag and drop it here just place it here just click on this small triangle select choose images local resources and import i will provide you each image i am using here you can see this add book and click on ok just go to description there i have put the link for the images okay so after that you have to change the size mode to the stretch image and just make it straight like this okay like this and after that we have one level here so let me just drag label so in this level we have to write add book so just go to proportion and search for text and then you have to write add book hit enter and after that change the font [Music] so go to search for font in the properties and click on this okay so it's taking a little bit of time after that you have to search for calibri and prefer calendar so bold and i will use okay hit okay and here you can see this that's looking nice okay so what i want is when i click on this button okay so when i fold that when i click on this button this form needs to be opened okay so first thing what i want is this form needs to be opened in the center for that we have to just go to properties and this this properties you have to change this windows start position to center screen and now in this form load it will open in the center so we have to connect this form with this button so for click button for this one just double click on this to generate a click event just double click on this generate click event so click event is generated after that we have to write one more thing that is add book okay so add book that is the form name and pbs you can write anything as an object name except the keywords okay so abs dot show so let me start this when i click on this here you can see this this is visible and this is looking nice and we have to add few uh text boxes few labels as well here we have to do that so let me just do that here we have one small problem that is when i always click on this new form will be open and number of forms can be open okay so if you want to prevent this here you can see this we have four form opened so you can see this so if you want to prevent this in your project so just go and check out my video that is how to prevent opening form from multiple times this video i have already added in my c sharp tutorial playlist just go and check out there okay so let me just add text boxes and label here you can see this in this we have three three six labels and five text boxes and one take time pick up so now we have this six six labels okay so we have to change the name as well so for the first one we have to change the name what is the name we have to change name let me just cross check so book name book author name book publication book purchase rate for price book quantity okay so just second one the same way you have to change text book name third one to book publication fourth one to book purchase date okay when you click on this change this one to book price after that change this one to both point key okay so i have changed the name of these labels and what i want is i want few text boxes take time picker and few buttons so you have to add text box for that you have to search text box let me just copy and paste so i have dragged one copy and paste free after that we need one date time trigger so let me just write a thing picker here and we need text boxes okay so this much is enough so i want to increase the size of this this much after that we need few buttons just drag and drop it i need to just copy and paste it okay so let me just change the name of these buttons as well so just go to properties and change the name let me see what is the name save and cancel so let me just change this one to save and this one to cancel okay so now let me just start this and let me just show you quickly so you can see this now it's looking nice but here we can see this this button is not looking nice so how to make it nice let me just show you just click on properties and go and you will find one small stuff that is here you can see this flat style change this one to popped up here you can see this the color has been changed for the same way you have to do for the second one and change this to pop up okay so when you start this here this is when you click on this it looks like it's being clicked here you can see this so it's looking nice but one small stuff is still remaining that when you enter something it's looking quite small so make it large so text enter in this needs to be large and after that these labels size also needs to be increased so let me just increase that just select this one select this font just increase this one to 12 here you can see this it's quite large so let me just change this one to calibrate okay so i have to increase font a little bit more or doesn't look nice so we have to change this one to 14 okay so we have to do for the rest one two so for that you have to just select all the stuff and just change this one to calibri and that is 40 and hit okay here you can see this is now looking nice so you have to adjust this all to a nice place or a specific place here you can see this what i want is i want to increase the font of these buttons so select both of this and increase the font as well so i'm going to make it nine or ten or a little bit okay so here you can see that it's looking nice let me just increase the size of these buttons after that what i want is when i enter something in text and stats the size of this also needs to be increased for that just select all the stuff after that select on this font and increase the size at least to 10 or 11 like this okay and let me just start this and when you click on this you can see this now whatever i write is quite large and it's looking nice the same way when i click on this calendar here you can see this it's looking nice here you can see this okay so that's it for the today's video guys in the next video i'm going to show you how to code for this save and cancel so for the next video just click on that i button upside and you will find the next video and for the previous video just check out my playlist or just go to my description video description there you will find the link for the previous video so thanks for watching and please subscribe to video channel and hit the bell icon and please share with your friends thanks everyone welcome to my youtube channel as you all know that we are working with library management systems and in previous video i have already shown you how to design the login form how to design this dashboard and how to design this add new book form okay so in this video i'm going to show you how to back-end code for this one now here you can see this when i click on this save when i click on this cancel nothing is happening so what i want is when i click on this the data from these text box and this data and figure needs to be stored into the database so how to do that for that first what we need is we need a table in that we can insert data okay so try to understand with the real time example if you want to store water then first what you need is some container in which you have to put the water in the same way we have to create a container that is stable that we can insert the data so let's start with the database first okay so let me just close this okay so here we go we have this now let me move to the database here you can see this i'm using this microsoft sql server management studio and just pause the video and first you have to create this one execute this one into your uh database okay so this will create a database live name with library and after that you have to create a table that is create table new book and this is b id that is the unique id and it's a primary key this is identity one comma one is this is written here to auto increment it by one always okay so b name is the book name book author in the same way let me just show you let me just start this and this one okay let me move here let me just show you here you can see this we have book name here you can see this this one book author name so here we have the second one book publication third one book date purchase date so this one is 41 purchase date book price that is this one and book quantity okay so we have this just pause the video and execute this query into your database first you have to execute this this will create your database after that you have to execute this one i will put these line of code into the description you can copy it or just pause and execute this so i'm just assuming that you have executed this query and now let me move to the designing part okay so let me move here first thing what we need to do is we need to change the name of these all text boxes and buttons as well so let me change the name of these text boxes okay so what we need to do is just right click on this go to properties and properties you can change the name so you have here you can see this is a name change this one to txt book name try to write some name which with which you can uniquely identify this text box okay so this one to pxt author this one to txt publication this one to date time picker we have only one date time picker so just leave it as it is after that book price so txt and change this one to txt quantity hit enter okay so we have changed the name for these all text boxes and we have to change the name of these two so let me just change this one to bt and save and this one to bdl cancel after that what we want is when i click on this save button the data needs to be saved into the database for that just double click on this to generate a quick event just double click on this after that we have to take all the values from these text boxes into variables so how to do that for that first thing is what name so let me just take a variable b name that is book name and we have to store data into this book name from where from the txt book name and from the this is actually the text box name not the containing text okay so we what we want to do is we want to extract the data from that text box so txt book name dot text and when you write this the data from that text box will be visible into this so you can also check that like this and s let me just add a break point here just to start this okay let me just show you that how the data is okay so let me suppose the book name is java java or code java when i click on the save button here you can see this when i hover on this b name here you can see this it contains java or code java here you can see this java or java it means that the data from the text box is now into this variable that has been in and if i remove this text so let me show you what happen if i remove this text it doesn't show any error but okay so it's showing an error let me just start this okay okay so we have to actually mention this one let me just remove this and do same for the rest of the text box and date time picker so second one is let me just check what is the second one book author name and book publication so book author name go to txt book author dot text like this we have to so we have something else with this one so let me just okay so it's fine so next is strength book author after that publication so txt publication dot next sorry here you can see this it's showing error that cannot speak on word here you can see this it's uh system dot windows dot form dot text box to string here you can see this we cannot convert this to string so that's why dot text is used to convert this one to string okay so fourth one is what fourth one is date time date time picker that is book purchase date so we have to take this one p date time picker after that what we have is price if you have not watched my previous video then i will suggest you to first watch my previous video after that continue with this one and if you have not subscribed to my youtube channel then please subscribe and hit the bell icon so that you get updated with our new content as well and the new projects okay so price is actually integer type so we have to take actually what in 64 okay so in 64 because if the size is much more larger than it can handle okay so after that we could not directly insert this value from this text box to here because the value from the text box is in string format so we have to convert this into this integer format so for that you have to write like this m64 dot parse and in this you have to write txt dot price dot text and just close this in this way you have to write in the same way we have to do for quantity q a n is equal to 64 dot bars and this you have to write txt quantity dot text now we have all the values into these variables so for after this what we want is we want to make a connection with the database so for that we have to write sql connection here you can see this a small pop-up is here because we have not included the library so when i include the library here you can see this the color of this line is changed so you can manually write this or you can do the same way i have done this system dot data dot sql client okay so after this what we need to do is we need to create a object that is sql connection object so for that bond equals new sql connection after this we need to pass the connection string dot connection string and here you have to write the data equals in this what we have to write is just you need to copy just go to your database that is microsoft sql server management studio just click on this file and connect object explorer and here you have to copy this stuff and you have to do one minor change that is let me just show you you have to just add one more slash here otherwise it will show error okay so you can see this after this you have to write the database name so my database name is library so here you can see this here i have executed this query create database library okay so after executing this you have to select library from this one here you can see this i have selected the library here library is visible by default it is selected master so you need to make sure that you have connected with this library okay so now after this you have to write integrated security equals true t needs to be capital later and after that you have to approach okay so connection string is completed you have to just write this line and after that you have to type sql command you have to create a sql command object so for that you have to write like this new sql command after this you have to pass the connection string so connection is equal to con sorry connection object actually and after this what we have to do is we have to actually open the connection because we are going to insert the data so there is no nothing is coming back from the database so we have to execute actually this uh execute no query okay so let me just show you connection dot open and this we have to open and close the connection as well and after that we have to pass the command text so command text equals what we need to do is we need to insert the data so insert into insert it to where the table name so my table name is new book so here you can see this make sure the small and capital letters so and it's capital and b is capital as well so let me just paste it here and after that you have to mention the column name okay so in the first column we don't want to insert the data because it's a primary key and it's auto incremented so we don't need to insert data here okay so what we do what we want to do is we have to insert into these columns so let me just copy this and paste it inside this one you have to manually write this one and after that what you need to write is values so the values are in these these variables so we have to mention the variables full string we have to write like this if we have the string so we have to write like this here you can see this okay so first single quotes then double quotes then two plus and then again double quotes and single quotes within this you have to mention the variable so first variable is what p name when you write will automatically pop up let me say this after that you have to add a comma and after that you have to add the same stuff like this then this to plus sign and within this book author the same way we have to do go to rest not for the price and quantity okay so make sure that publication after that we have the date time clicker that is also in the string format so i'm sorry so what is the name let me just check p data actually and after that what we have is after publication we have date and our finally we have price and quantity okay so for integer type you have to just put double quotes directly under that two plus sign you have to just leave the single quotes okay so let me just type price and the last one is the double quotes you have to write point t like this just close this there's double quotes and this one here you can see this just pause the video and just write this stuff don't forget this double quotes at the last after this closing packet okay so now we have done with this and after that what we want to do is we want to actually we have to execute the query so for that just enter and you have to write cmd dot execute no query like this after that this query will take secured it means that data will be inserted and after the insertion what we need to do is we need to close the connection so pawn dot close and save this after this data insertion what we need to do is we need actually uh confirmation that data is inserted so how to do that so message box dot show and in this you have to write one thing that is data saved saved and the best box name will be success so you have to write like this and this is a message box buttons needs to be only one that is okay and after that i want message box icon that will be information and just close this and let me just start this and let me show you so add one thing so book name will be like something open source and book author name will be ibm suppose something and book publication okay publication needs to be xyz publication and purchase date will be to the date as well and price will be 3000 each book and quantity will be 24. before saving let me just execute this query and show you in the database what we have actually here you can see this we have only three books right now let me just execute the query save this so we have some errors so sql argument exception occurred in dll so keyword not data is supported okay so there is a okay sorry so we have to actually write data source here so just save this and execute this once again and php okay sorry php author name will be php.d by x like this publication [Music] data is saved click on ok and when i execute this once again you will see this php is here php.pyx xyz publication now we have the data oh here you can see this now save button is working properly but still we have some issue what is that after the completion what i want to do is i want to clear these text fields so i'll do that let me just show you let me just close this one so after that when user uh click on ok we want to clear the text box okay so after you have to just mention the code after this message box so what we need to do is just txt book name dot here either you can use this method or you can set text is equal to none so txt txt author dot clear txt publication dot here txt price dot clear txt point dd dot here so these stuff is here okay so now let me just show you one more stuff is that when i suppose we have not entered anything into these text box and leave left few text box empty and when i click on this what will happen this will generate um exception that is uh cannot insert the null value let me just click on this here you can see this our project is crashed so we have to take care of this one too so for that we have to check the condition that is if text box author or text box book names dot text is not equals what so this is actually null so you have to do this for this for the remaining text box as well and you have to write here you have to check for all so we have to just copy this and you have to write the txt author and paste this one like this you have to just write txt bookman price you can see this we have book name book author and after this what we have is book publication and after that we have to check for txt price and quantity txt okay so so you have to add bracket here you can see this in the else condition we can mention fill the text box okay so you have to write message box dot show and you have to write empty text box can not empty text box not allowed empty feed you just write this not allowed okay so let me just name this message box error and after that message box button dot okay and after this message box i can dot error or warning just let me okay so let me just change this one to warning and save this and just try to execute that once again when you click on this empty fill not allowed and our project is still running so if you fill resistor and if you still click on this it will show like that when you still click it will still show so finally when you enter something this will be completed so now the stuff till here is done so we have the code for this cancel so what i want is when i click on cancel i want to close that this form so for that you have to just double click on this and you have to just write this dot close and this will close your form so here we have still we have one more step that is you have to ask for yourself that are you sure you want to do because closing this form will be delete your data so let me just show you what will happen if i directly use that button so just click on this suppose you have written some data already failed and you click on this by mistake then these data will be deleted okay so when i click on this here you can see this is closed and when i reopen available in the same way i have shown you message box dot show and here you have to write this are you sure this will delete your unsaved data okay so this is quite large message so let me just cut this one and paste it as a name of the text box sorry name as name of the message box and after that message box icon button actually message box button button that is okay or cancel and message box icon needs to be warning and we need to actually check that if user click on ok then this report needs to be excluded here you can see this i have put this line of code into if condition so you have to write this equal equals to dialog result dot okay when user okay we need to close this one okay so let me just show you when you start this when i go when i click on this here you can see this this will delete your unsaved data when i cancel nothing will happen if i click on ok this will close this application okay so that's it for the today's video guys for the next video just tap the i white i button upside and in the next video i'm going to show you me just show what i'm going to show you in the next video the next video i'm going to show you how to design this new book form okay so how to design this all the stuff how to design these buttons as well here you can see this we have added this book today so i will show you each of these stop in the next video so just stay tuned with us and please subscribe and hit the bell icon and also like this video and keep your feedback in the comment section thanks for watching please subscribe hello everyone welcome to my youtube channel in previous video i have shown you how to back-end code for this add new book here you can see this for this form how to back-end code how to save this data into the database and how the table how to create the table and which type of values it's going to store and how to code for the save and cancel okay so you if you have not watched my previous video then just go to description there i have put the link for the previous video so in this video i'm going to show you how to design this form okay so when i click on this here you can see this the data is here with the panel and you can scroll it down and you can also search with this here you can see this so in this video i'm going to show you when i click on this refresh here you can see this scroll bar is removed and the panel below this is also removed here you can see this this stuff are also removed okay so i'm going to show you how to design this form so let's start with that so before starting if you have not subscribed to my youtube channel then please subscribe and hit the bell icon so that you get updated with our new content okay so in this video we are done till here you can see this here you can see this we are done till here okay so in this video i'm going to show you for this one okay so let me add something so first thing what we need is we need one form so let me add you know new form so for that just go to library you right click on this click on add and windows form just name this form view book and hit add now here you can see this new form will be added and let me just copy the size of the form so that it looks similar okay so let me just right click on this and here you can see this size is here just copy this one and just right click and go to properties and here you can see this just paste it here so you can see this this is a form here so first thing what we need to do is we need to add one panel here so let me add one panel i will show you why i'm adding this panel this way we have to add like this okay and change this panel background color to white so back color here you can see this just click on this custom and white after that we need a picture box so for that just select a picture box drag and drop it here why i'm adding a picture box here you can see this we have panel of white color and this one is a picture box and we have this one label okay so let me show you how to do that so first step is that add a panel and make that color white after that just click on this picture box choose image local resources it will open your local pc directory and there you can select the image so i have opened it and i have used this gif okay so let me open this hit ok and select stretched okay so here you can see this after this make it large like this and when you start this and click on this nothing will happen because we have not added that into this okay so let me add that first first thing what we need to do is i want that when user click on this view button so this needs to be loaded to the center so for that change the start position here you can see this and properties of the form you can change the start position to center screen now that save is and just go to your dashboard and just click on this just double click on this view book so click if it is generated after that you have to type view book dot pb equals new loop book so basically we are creating a object and after that you have to write pb dot show and save this and just start this one when i click on this here you can see this now picture is added and it's working fine so don't you worry about that the image each image is an icon i'm using in this project the link in description you can go and download it from there and start working with this okay let me make it a little bit large and after that you have to add one label let me just drag and drop it change this name of this to viewbook hit enter after that we have to change the form font as well as color so let me just add calibri to actually 18 calibri after that we have to change the color for color just click on this and select the highlight you can see this that's looking nice after that here you can observe on a small stuff is that we have one label text box and button so we have to add these three stuff so for that you have to add label first thing is label so drag and drop it here after that we need to add text box just go to tool box and they define text box and after this we need one button as well so butter drag and drop it here make it large little bit okay so we need to change the properties for these stuff so first thing i'm going to change this label to book name so we can search with the book name okay hit enter and make this font a little bit large change the font so it's looking nice and also increase the font of this text box to 10 change this button here you can see this flat style change this one to pop up and after that you have to change this text form so make this one little bit bold and 10 and hit ok and change this text to just change this one to refresh okay okay so after that here you will observe this is a panel so this is actually data grid view so let me add one data grid view here just search for data grid view and drag and drop it here after that make it large as of form size okay and let me just change the background color of this form so let me copy the color code from here you can see this color code is nothing but this one you can manually write write it so search for back color for this one select the form and after that go to properties and this in this properties just change this back color you can manually write it 255 comma 192 comma one two eight and hit enter the color of the background is changed now and now when you start this and when you click on this then you can observe that it's looking nice and you can enter the text in this as well and this button is look nice okay so after that what we need to do is we need to add one more stuff that is let me just show you here you can see this there is a panel and this panel we have these stuff with these buttons okay so and we have to also add this scroll bar so how to do that first i'm going to show you how to add the scroll bar so just go to properties of this form and after that you have to search for auto scroll so you can see this and you have to make this true when you make this true it means that the order scroll is available okay so after this follow my steps don't worry this will be visible okay so make it large little bit like this okay so not to worry about that you have to just follow steps what i'm doing and after that we need to add one panel so let me just drag and drop one panel here change the color of this panel grayish so let me just go here and change the back color of this panel okay so you can see this just click on this and you just select this one okay so it's more dark so let me just make it a little less dark where you can see this now it's looking nice okay so now when i make it small you can see this automatically this scroll bar is here so in the same way i have done so not to worry about that okay so let me just add the stuff here so what we need to add is we need a few labels so let me just count how many levels we need so here we need three three six labels and five text box and one date time picker and three buttons so let me add these stuff here so we need labels we just copy and paste to replicate we need actually six so we have to add six labels after that we need text box so drag and drop it copy and paste to replicate so if you have not watched my previous video then link in description you can go and check that out and please subscribe and after the search for button just drag and drop it we need actually three buttons so we need to add so here we did one mistake is we need one date time picker let me just remove this one and add date time pickup sorry time we go let we have this one so we need this okay so after that let me set text for each of these labels one by one so what is the text let me just check this out book name book author name book publication book purchase date book price and book quantity okay so let me just add it one by one just right click on this and go to properties and after that search for text and in this text first thing what we need to add is book name hit enter change the second one to book author name change this one to book publication this one to book purchase date and this one to book price and change this one to book quantity okay so here we have to move this a little bit so we have to stop like this okay so not to worry about that so you can see this and change this names as well so change this button to text to what we have the button name let me just check this out update delete and cancel so just first one to update delete and this one to cancel okay so first thing we need to increase the size of these levels as well because it's not looking that much nice so how to do that so just click on this go to properties and search for font and click on this select 12 okay so you can see this is looking nice the same way do for the rest just select all one by one after that click on this font select 12 and hit ok ok so let me adjust these all at the proper position you can see this that's looking nice so we need to move this little bit right okay so we need to actually increase the font of these text box as well so select all by pressing the ctrl key make sure you only select these text boxes not this panel if you select this panel the size of this panel will be increased and that will confuse you so let me just make this to 10 hit enter and make this one larger like this and make this one smaller okay so you can do this one by one or like i have done it so one more step is still remaining what is that that is we have to actually add change few properties of these buttons so that it looks nice so first thing what we need to do is we need to actually change this one so flat style change is going to pop up for all of these that is time to pop up this one to also pop up okay and we need to increase the font as well so just select on that select nine and bold and hit okay you can see that it's looking nice the same way for this one two nine and bold hit okay for this one two nine bold and okay just make it please but a little bit larger okay so and after this doing all this stuff you need to do one small stuff like that you have to just minimize this little bit like this you have to make this form a little bit smaller and after that drag this one little right okay now i'm going to start this and when i click on this here you can see this it says scroll bar and everything is working as we have designed okay so when i click on this here you can see this it's looking nice and we can actually fill the data you can select everything okay so you can see this okay so how that when i click on this data from this detected view and this is visible all that stuff i'm going to show you in the next video so just stay tuned that's it for the for this video guys so just stay tuned with us and for more videos just subscribe and check my playlist thanks for watching and just stay tuned for the next video thanks hello everyone welcome to my youtube channel in previous video i have already shown you how to design this form here you can see this how to design this all stuff how this is scroll bars so if you have not watched my previous video then then just go to description i have put the link of my previous video just watch that first and after that you can continue with this one okay so in this video i'm going to show you how to fill data and how these buttons will work okay so without wasting time let's start with that okay let me just close this first okay so first what we need is we want that this data needs to be filled with the data which is view book okay so in the database we have this let me just execute this one okay so let me just change this one actually library and after that let me just execute this and here you can see this we have these data into our database okay so database table name is new book okay so we have this okay so first thing what we need is we want this uh data to be filled let me just change the name of this data grid view first so okay let me just leave it uh so for that what we need to do is we need to generate a load limit of this form so for that just double click on this form and here you can see this view book load if it is generated and here what we need to do is first we need to actually make a sql connection for that sql connection and here you can see this is small pop-up is here just click on this here you can see this this one line is added here you can manually write it or you can do the same way i have done okay so you can see this after that create an object of that so con equals new sql connection and after this you have to pass a connection string that is connection string and this you have to write the data source and you have to pass the data source from here go to your this one and here you have to just copy this line server name just cancel this and let me just move back here and just paste this add one more slasher otherwise otherwise it will show error after that database name so i have already told you that my database name is library and after that type integrated security equals true okay so after this line you have to write one small step that is nothing but sql command cmd new sql command after this we have to pause the connection object to this command here we go now okay after that we have to pass the command text so what actually we need from the database is all the records of from this new book so i'm going to write select star from my table name is beautiful okay after this what we need to do is we need to store this data which is redriving we are driving the data from the database we need to store that into something which is nothing but data set okay so for that we have to first create sql data adapter okay and after that you have to write this da equals blue sql you have to write this sql data adapter and within this you have to pass the command that is cmd and just close this after that we need to create an object for the data set data set ds equals new data set and just fill this data set with like this ta that is the sql data dot fill like this okay so let me just start this and when you see here okay so nothing is here because now we have the data into this data set but we have not assigned that data to this data review so how to assign that for that you have to just write this data group to one this is the design name of this database let me just show you here you can see this data could be one so detect will be one dot data source equals the object of data set that is ds dot tables and in this you have to pass 0 and just save this and execute and when i click here you can see this now we have this data here so now what we want is uh initially we don't want this uh form needs to be visible so for that you we have to write one more small stuff so that's not an issue at last i'm going to show that okay so let me just close this okay let me just actually hide that stuff so for that let me just take the name of that panel so this is the panel and this panel name is two so panel so now when i start this here you can see this there is no strong word and nothing is down here okay so now what i want is when i click on this row this form needs to be hidden sorry visible the panel needs to be as well so let's start with that so now what we want is we want actually uh data grid view self click event so for that let me just go to this data that will just right click and go to proportion this search for event self click given here you can see this this one is just double click on this and it will generate a self click event this you have to actually check that which row is being clicked for that how to check that we have to write this if data review one dot rows okay like this r needs to be in capital later after that we have y e dot rows row index this e is nothing but from here you could say this okay so after this we have to write dot cells and in this cell we need to e dot column index and dot value is not equals [Music] the first thing we are checking this and after this let me take a message box massive box dot show so actually i want to show which cell is being clicked so for that i'm going to write this like so pass because we are going to take the user actually let me just show you so here we have this uh at number of rows and i want actually the book id so book id is nothing but in the end format so for that i'm going to pass this okay and dot parse to [Music] and this you have to write this one like data grid view one dot rows dot row index and dot cells dot rows cells and in this cell what we need is zero that is the first one and the value dot string like this so it's showing a little bit of error just resolve this quickly for now let me remove this uh past we have to do this later okay so not to worry so here you can see this now the error is resolved and let me just start this and here you can see this when i click on this cell here you can see this is the 2 this is nothing but bid okay so let me just click on this here you can see this vf5 anywhere you can click we get this one why because because we have set here that cell which cell value we need is zero zero column okay so we need this value and we are converting this to the string here you can see this in this way so now we need this into a variable so let me just take a global variable so i will show you why i'm taking this so and really now we have this pid so vad equals and here we need to do nothing but internet pass and in this part we have to pass this stuff let me just copy this and paste this here just comment this one okay so i will show you where i'm going to use this bid okay so after this what i want is when i click on that cell first thing now we have this id book id after that what we need to do is the panel down here this panel needs to be visible for that we have to write panel two dot visible equals true okay so now let me just start this and show you quickly here you can see this now when i click on this now panel is visible you just screw this and start this here you can see this nothing is there no scroll bar nothing when i click on this suddenly you can see this scroll bus it is here and now this panel is also so till here the task is done after this what we want is we need to create a database connection for that i have already shown you how to design this let me just copy this stuff and paste it here once again and make a little bit change so here what i need is select to start from due book fair will be a this bi d is the actually primary key column name here you can see this in this table b id is nothing but primary key here you can see this when we click on the cell this value is being extracted okay so let me just show you where bid is equals so we are concatenating this value so here we have a local variable and now we have the value into this pid so let me just add here va okay so whenever we click on this the data matching from this pid will be stored into this uh data set let me just show you and we just add a breakpoint here and we just start this i'm going to click on this and here you can see this inside this we have only the data for which we have clicked okay so on five i have clicked all the data one d or five is here so now we have the data now what we have to do is we have to assign these data into these values for that first let me just change the name of this text boxes so we'll go to properties and in this let's change the design name so let me just change this design into phd and this one too txt author this one txt publication let me just remove this with the text box okay let me just copy one text box from here and paste you it change this one to txt txt after that this one to txt price this one to txt 0.3 now we have changed the name of these text box now what we need to do is we need to assign these values let me just remove this now we have the data into this data set now we have to assign the values to that uh text boxes so how to do that for that we have to actually do small stuff that is txt name dot text equals from this data set yes dot tables we have tables and in this table we have rows and we have so how this is working let me just explain you quickly in this data set we have one table that is zeroth table and in this table we have rows and columns so this is row and this is the index of the row that is zero through we have only one row so here you know that we and this we start with the zero zeroth row and the one column first column because if we write a zero then we will assign the value of this bid that is the primary key value will be assigned to this text box name so let me just start this and see this if it's working or not okay so when i click on this here you can see this book name is oops now when i click on java here you can see this change php it's being changed okay so this is the zeroth column this is one this is two this is three this is four this is five and this is six if we write zero then this one will be assigned this two will be assigned when i click on this row okay let me just cut this and in the same way we have to do for the rest so let me just copy this is stuff and txt or third dot text equals and just paste this txt and after this we have publication dot text txt date purchase date action edit dot text equals txt what we have next is price dot text equals txt dot so we have to actually change this small stuff here here you can see this we have one one one one in each of this step so we have to change this to this one to three because it's third column this one to four this one two five this one two six just save this and just start and when i click on this here you can see this data structure jp sync upon rnd monday here you can see this everything is here and p price is 5 000 point it is 45. you can see this when i click on something else all the data is changed now so till here it's a start group so now what is one does this button needs to be also work so first thing what i want is i want this cancel needs to be bought so how this will work so let me just close this and let me just go and change this name of these buttons as well so btn4 let and change this one to vtn update now double click on this to generate a click event just double click on this and what i want is when i click on cancel the form needs to be hidden the downward panel so let me just write this pattern to plot visible volts false that's it you have to true this is stop nothing more so you can see this when i click on this data is there when i click on this here you can see this all the stuff has been removed you can see this okay so it's working now now what we need to do is we need to update the query so okay so before updation here you can observe one smaller stuff that is we have a text button okay sorry text box so let me just change this name text box to txt book name okay hit enter and what we need to do is we need to actually go to event and we need text change event so just double click on this and exchange if it is now generated and here we have to do small stuff that is if textbook dot name dot text first we are going to check that it's not equal to empty then we need to execute this query okay and in the else condition what i want is when this text box is empty we directly want to assign the all the values from the database okay so let me just copy this stuff from here you can see this actually copy this much stuff so just paste this here so if there is this is empty then we want the original value when this form loads that value okay and if it's not empty what we have to do is we have to actually make small change here in this query so select the star from new book where b name this b name is nothing but the column name of this here you can see this this is the book name column name sorry in the table okay so you have to write that in the same you have to make sure that if you have mentioned this and in the capital then you also write here in capital okay so you can see this and then this b name what we have to match is b name like you have to use this operator after that concatenate with this so plus txt book name that is the xbox name dot text and just add close and after this we have to write this percent d okay sorry it's percent only means that you have to actually after this first letter anything will be searched okay so like this here you can see this now it's right it's not showing any error let me just start this and let me just show you quickly so view book and here okay so it's been written error exception okay so not issue let me just start this okay so when i write oh here you can see this only one row is there and when i clear this everything is clear okay so let me just close this so now it's working you can see this now our text box is also working so now we have to code for refresh button and you can see this we have one refresh button as well so you can see this when i click on what i want is when i click on this respace button all the data uh let me just show you what i want is when i click on this refresh button this panel needs to be hidden and all the data from this text box needs to be clear so that let's just you have to put a little smarter way so just change this name to vdn refresh hit enter double click on this to generate a click event here we have this so first thing what i want is to clear the text box search box so dot clear and i what i want is panel two dot visible equals false these two small stuff i want here you can see this when i start this and here you can see this let me just search something like oops and when i click on this here we have this when i click on this the data the form is in our initial position so it's working now so we have to code for actually update and delete as well so how to do that so let me just show you for that first we need to generate a click event for the update button just double click on that to generate a click event here we have so now we have to take out the value from each text box so just string b name equals the variable name so this is the txt name is a text box name of this one and from this text box what we need is we need only text so in the same way we have to take the value from other text box also so focus after that we have spring publication and pxt publication dot text after that we have string predate equals to txt dot text and after that it will observe one smallest term that is book price and book quantity is an integer format okay so for that we have to convert that into and in 64 let me just take this price equals n 64 dot bars you have to convert this string into integer so txt price dot text like this and the same if you have to do for quantity quantity dot text okay so now we have this stuff here after that we have to make it sql database connection for that i have already shown you how to make this just copy this stuff and paste this here okay so here we have to change this query we need to actually execute what is that is update query so how to execute that so update new book that is table name so i am writing this n capital and b capital because my table name is in this format so you have to make sure that you write in the same character sequence okay so update new book and what i want to do is set that what is that name equals and this is a string so i have to concatenate it like this and i have b name this is the variable name here you can see this and this b name is actually the column name in my table so you have to follow this okay so make sure you write in the same order and after this what we have is book author so b author and this you have to write the author after this you have to write we have the publication actually let me just show you because it is the publication after that predate all these stuff are here so in the publication we have to write like this okay so let me just copy this stuff but and within this publication we have to write publication the variable name here you can see this after this we have purchase date p p date i'm going to paste this and here what we have is speed and now till this p date is done so after this period what we have is price quantity okay so price is an integer format so you have to follow that so price is actually the price equals and you have to just put double quotes not that single one there you can see this in the string we have one single more quotes but in this integer format we have only double quotes not the single one okay so within this we have the price this is the actually object sorry variable name so the same we have to do for the quantity so now if you think this query is completed then you are wrong why because when you start this and when you click on this and when you click if i click on this all these rows value will be updated with this because we have not used fair clouds here you can see this so update new book set this will set each row with the same value which is in the text box so how to restrict that i want only what i want is okay so when i click on this what i want is i want to only update this row not other row so how to do that so for that let me just show you we have to move little bit upward that is nothing but here cell click here you can see this okay so we have to move here so here we have to actually take this 64 and row id i want to take this row id okay so let me just take this value here i have taken a variable pro id and here let me just type row id and in this we have to write n64 dot paths and within this we have to actually write this one let me just copy this stuff and paste it here and we have to change this one to zero okay so let me show you what actually is i'm going to do it here just start this when i click on this here you can see this now row id is 4 okay so let me just show you this data set so just click on this here you can see this p array is four and this p array is now in this row i okay so let me just start stop this and let me just this is a global variable so i can use this here also so i'm going to use it here okay so how to use this let me just show you quickly so you have to write here fill pid that is the id primary key is what the bi ds is stored in row now when i update that only that particular row will be affected so let me just show you let me here you can see this this php is in a small letter so let me just make this one capital like this when i click on update and close this and load this once again here you can see this php in capital letter so now this is working so now what i want is before updation i want the user confirmation that yes you want to update or not so how to do that for that you have to actually write one more line of code so that for that you have to write this if condition message box dot show and in this you have to ask user data will be affected and ask for user confirm and this message box name will be success and message box button [Music] like this and after this equals equals dialog result so what we have done is we have set if condition and then for an update will be clicked this message box will be shown and it will ask that do you want to confirm and there will be two buttons that is okay and cancel if here we are going to check that if if that foreign will be clicked then this updation is performed if cancel is click then nothing will so let me start this and show you quickly so here you can see this when i click on this you can see this data will be updated confirm so cancel so nothing will happen let me just close this and start this once again here you can see this now no later it's updated okay so how to update that here you can see this book point is two okay so let me just make it back so update and cancel and here you will observe that nothing happened to this data and when you remove these zeros and update and click ok now the data will be updated here you can see this now we have 24 now okay so now our task is done here so now what i want is i want to actually uh delete vr rest we have to do for this delete button so how to do that just double click on this to generate a click event and we have to copy this all stuff from here just copy this and paste this here you have to remove this stuff okay and you have to actually remove this query as well and you have to write one small query that is nothing but linked from new book where pid equals plus plus and this vid is stored in row id that is the global variable i have declared on the self click event i'm extracting this value and i'm using it here now here we want this confirmation little bit to change data will be let me just delete it confirm [Music] confirmation dialog and i want this to be warning okay so now let me just start this and here you can see this when i click on this and when i click delete data will be deleted confirm here you can see the logo is changed here you can see that this is question mark and this is warning so let me just cancel i'm canceling it nothing will be deleted here you can see this we have these four records let me just add one more record quickly so book name asp dot net and book author asp xyz publication xyz publication purchase date needs to be to date and price will be eight five five and book cointree needs to be 152 and just save data saved cancel okay so now let me just here you can see this this six number is added i don't and i want to delete this record let me just click on this delete and click on ok and just cut and just open this here you can see this now this record has been deleted so for the today's video that's it for today's video guys the next video i'm going to show you how to design for this student ad student okay so let me just show you quickly so this is actually complete project and here we have so in the next video i'm going to show you how to design this okay so till then just stay tuned and just subscribe to my youtube channel and please hit the like button and share with your friends thanks for watching everyone welcome to my youtube channel in previous video i have already shown you how to design this few books and how to back and code for this one okay so if you have not watched my previous video you can just go to description and you will find the link for my previous video okay so in this video i'm going to show you how to design this add student form and how to back in code for these all buttons and how to take data from these all text boxes as well so let me start with that just close this and let me just go okay so we are working with library video this uh project so let me add new form so first what we need to do is we need to add one form so let me just right click on this and click on add and after that windows form so this here you can see this now form is being added and you have to write the name add student and just hit add and this will add a new form into your project and here we have this okay so let me just copy the size of this form from the completed project here you can see this let me just copy the size of this form okay so you can see this is 700 and 467 and we just go to proportions of this one make it large you can see there's the size just paste it and hit enter this form shape will be changed so here you observe on a smaller stuff this is actually here we have two panels and one picture box this is a picture box and this is a panel and this is also a panel so let me add these stuff in our project so you can see this first thing what i need is panel let me just drag and drop one panel here like this place it on the right position make it large like this check the background color okay for that just go and select the back color and in this you have to select like grey okay so after that here you can observe on a smaller stuff we have picture and as well as something written over it so let me add that stuff too so let me just try one picture box here we have now let me just select the image uh all image i'm using and all i can i'm using in this project the link of that image is already in the description you go and check it out and start doing it by yourself so let me just click on import and after that it will open the file i have provided in this you will find this image add a student and click sorry if this is not the image actually here we have this one so just open it and click ok and you have to select this one stretch image and after that make this picture box large according to your requirement but you can see this now it's looking nice and after that you have to add one level and on that level you have to change the text actually just right click and go to properties and in this you will find the text here you have to try what add student and hit enter just change the font of this one so go to font and click on this it will take little time okay so bold and something 40 let me just select this one and put it in this way okay so now it's looking nice and after that let you observe on a small stop that is this is a picture box so i'll add a picture box i've already shown you let me just drag one picture box after that just drag and drop it here and make this one large like this okay after that click on this small stuff choose image click on this this one and hit okay just select this stretch image and after that it will look nice okay so you have to do this stuff follow step by step don't skip anything after that we need one more panel so let me just drag one panel here like this one and make the size of this okay and we have to change the color of this panel as well so let me just copy the color code of this one so this is the color code let me just copy okay so just go to properties search for back color here we will find this you can manually write it there you can see this and hit enter you can see this the color has been changed okay so now we have this stuff here so make it large and adjusted corner to corner let me just copy the size of this panel as well so just copy sides size of this panel is 670 5 and 77 so let me just paste this one because it's little smaller so we have to make this light so that it looks standard and make this large upward and change this color as well so just change this back color okay so now it's looking nice after that what we have to do is we have to actually add few labels and text boxes so let me add labels just drag and drop how many let me just count one two three four five six actually it's total six so i have to add six label so just copy and paste like this four and now here we go so let me just change this first one and what we have to change is we have to write student name so just go to text here you can see this and you have to write student name in this label you have to write enrollment number and in these two what we have to write as department student sorry the smell spelling mistake here okay so we have to write department student semester student contact student email so let me just change all this stuff quickly so semester and in this one we have to write student contact and for this one we have to write student email after that we have to increase the font size of these labels as well so how to do that just go to font click on this and make it 10 or a little bit more larger so let me just make this 12. okay so now it's looking nice in the same way you have to do for the rest of the labels so just select one by one by pressing the serial key and after that you have to just go to font and select 12 and hit ok let me see this size of all has been increased okay so i will put it into the right position after adding text boxes so let me just drag and drop the text boxes here copy and paste to replicate so now here we have six text boxes as well so let me just put a little bit right side after that increase its size to this much and keep equal distance between all these text boxes so that it looks standard okay so now it's looking nice just adjust all the stuff so now what we are missing is nothing but these buttons so let me add few buttons here so just search for button just drag and drop buttons and just copy and paste to replicate i need actually three buttons let me change the name of these so refresh save info and access so full preference refresh and change this one to exit here you can see this now we have these buttons here but it's not looking nice so how to make this button look nice so for that you have to change few stuff that is flat style here you can see this properties of the button and there you will find this flat style just click on this and you will find this pop-up here you can see this now it's looking nice the same way you have to do for the rest just change the slider style to pop up and this one to pop up too so now it's looking nice after that we have to actually increase the font of these um text written in sign days so for that you have to just go to font and just click on this make it bold and 10 and it will look nice here you can see this is looking nice okay so it's actually we have to make it large okay so here we have now so now the form is ready and what we want to do is when i click on this button here we have this button add student this form needs to be open so let me just go for that just double click on this and it will generate a click event for that button so after that we have to create an object for add student form name that is add student here you can see this add student to the form name and asd i will take the object name so add this to it after that like this you have to write and est dot show here you can see this now just start this and when i click on this add student and here you find this this is working and everything is not perfect and enter everything anything into this okay so let me just start with this here you can see this one smaller stuff is that it's not in the center okay so how to do that for that you have to just do a minor change just go to properties of this form and after that change the start position here you can see this you have to just change the center string let me start this once again and let me show you quickly so here you can see this now it's being started in the center okay there you can see this each time i click it will be in the center and it's looking nice okay so let's start with the coding part of this one okay so first thing what we have is we have to code for this and this as well and after that finally i will go for this so what is this exit button so just double click on this okay let me remove this and first change all the design name of these okay so let me just check this stuff from here remove from here too so first let me change all the design name for these all buttons and text boxes as well so let's just go to properties and after that you have to search for design name here you can see this text box one so this is not text box one this is actually pxt name and this one to txt enrollment and this one is txt department try to keep the name in such a way that with the name you can identify text boxes so you can see this with this txt department i can identify that from this textbook we are going to get the department name okay so the same thing you have to do pxt semester and this txt contact and this one to txt email and change his name too so let me just change this to ptn refresh and this one too bt and save and this went to btn access so now we are ready with the coding part so we can actually code for these buttons and now everything but before that what we need to do is we need to create a table into our database so actually what is it in real life if we compare within the real life then if you want to store something first you need a container so before saving the data we need the table so let me just go to the here to my database and let me just select this one to library i'm working with the library my database name is library so you have to execute this query don't make any changes because i'm going to write code on the same basis here you can see this my table name is new student and my primary key is stu id and it's of int type and it's required value for that i have used increment it is auto increment and it's a primary key i've declared it here so you have to write in the same way or you can just go to description of this video and you can copy this code i am going to put this this line of code into my description okay so student name is where karen 250 involvement is 250 department is where ketu 15 not now all our not null contact is big end strike because it's saying type and you can't take actually end because it cannot handle the 10 digit value so that's why you have to take this big end so be careful at this position okay so after that email 250 not null so you have to execute this query and just pause the video and execute this one okay so let's move further so after that you have excluded that query and after that we have to get started with the code so first thing what we have to do is we have to close this application when i click on this access button for do that just double click on this and here we have the click event so what i want to do is just close that form so this dot exit okay sorry this dot close we have to use okay let me just start this and show you so here you can see this when i click on this and this will close the application so what i want is before closing it should ask from the user that if you want to close or not so for that if message box dot show and ask you to confirm this is your message which will be visible alert the message box name after that this message box have you button that is okay and cancel after that message box icon needs to be warning and this will let me just check that what user clicked okay or cancel so you have to write dialog result dot okay when user enter okay this code needs to be performed okay so you can see this let me just click on start you can see this and i click on this alert confirm and this is a warning symbol with the okay and cancel button so if i click on cancel nothing will happen if i click on ok this form will be closed okay so here we have this stuff so now we have to do for tests refresh so what i want to do is when i click on this refresh all this text box needs to be empty so for that just double click on this here you can see this currently first click if it is integrated and after that you have to clear the text box so name txt name dot here txt after that what we have is enrollment dot here after that we have txt department dot clear txt semester dot clear txt mobile or contact dot clear okay so let me just start this and show you this if this work or not there you can see this i have written everything something on all text boxes and when i click on this all text boxes are empty so it's working so there is one another way to do this either you can do like this with the clear method or you can do like this txt email you can see this i'm going to write here and when i click on this it's being cleared okay actually you're assigning null to this uh text box and assigning what text that is what so this will work actually okay so after that we are left with this same info so how to do that just double click on this and we generate a click event for this one and first what we have to do is we have to take extract the value from all text boxes into the variables before that first thing is i have to take a string and what we have first thing is name so the text box name is txt name and from this textbox what we need is text okay so we have the second string so write and draw equals txt and draw meant dot text the same way you have to write for this string we have department first thc department dot text after that we have string sam that is semester txt semester dot text after that we have what actually we have mobile number so we have to be very clear on this that mobile number is an integer format so we have to convert that string to whatever we are going to write into this text box is already in the string format so we have to convert and i'm going to show you how to do that for that first we need to take a integer type variable as well so i'm going to take this and after that you have to write like this n64 dot parse parses method utility method with that you can convert it string to a variable okay so in this you have to write this txt contact dot text and when you write this this will convert your integer sorry string type value into the integer type okay so finally we have email and equals txt email dot tag here we have now we have all the values here in these variables and now what we have to do is we have to make the sql connection so sql connection you can see this it's not showing because we have not imported the library you have to import this one using system data dot sql client when i click on this here you can see this it's being added into my library that is using system.data.sqlclient after that you have to create this sql connection object so on equals new sql connection after that you have to write this connection string equals this you have to write the data source equals and whatever you have to write here you have to just copy from your this uh microsoft sql server management studio you have to just go over this connection object just copy this stuff this one so one name just ctrl c and just come back to your project and paste this and add one more forward slash here so guys it will show error so now we have this stuff here after that you have to write the database name so my database name is library as you already know that and if you have not subscribed my new channel then please subscribe and hit the bell icon so that you get updated okay so database name is librarian after that you have to write integrated security equals true so you have to write this stuff and this will perfectly work after this what we have to do is we have to create a sql command [Music] sorry we have to pass connection to this command okay so cmd dot connection equals con you have to pass the object of this here you can see this i'm passing it over here and in the previous video i have shown you that we are going to use the data adapter that's very sorry data set that's why we are going to directly execute the query but here we have to manually open the connection and after that we have to perform the operation so because we are going to execute a non query execute non query so that's why we have to write this open this will open the connection after that we have to pass the command cmd dot x command text and in this what we have to do is we want to insert the data so what is the table name of my data is new student let me just copy this make sure and in the capital ns is also in the capital so don't change that sort into table name here we have after that you have to type each column name so you can see this my column name i'm going to sort of leave this one because it's a prime again it's auto implemented whenever a new record will be inserted this will be get updated so we don't need to insert this so we are going to copy the code from here as name enrollment so i have already written it here you have to just write this stuff and just copy this and paste it here okay after that just close this and what you have to insert you have to write the values here so how this will work so for a string we have to write in this format with double double and single and we have to add two plus sign here and one comma let me just copy the system i will just this will make my coding a little bit faster so after that you first think what we have is name and after that we have to paste it and we have to actually type and again third follow the same sequence first in the table we have name involvement department then semester then contact them emails so first i'm going to insert name here if you see this after that enrollment and after that what we have to insert is and after department what we have is semester and after semester what we have is contact so don't paste this once again in semester in contact you have to do just double quotes and within that double quotes just two plus there is no single quotes for integer type make sure and our name is mobile for that variable after we have to paste it once more and just remove the comma from the last and after that i am going to write it just close this double quotes and just like this and this will execute perfectly so after this writing this you have to write just one step that is cmd dot execute not query like this and just close this and after this we have to close the connection as well so just write like this you can see this all error has been resolved and this will working perfectly so after this what we have to do is we have to show the user that data is inserted successfully is successful so for that i need a message box so message box dot show data saved success message box name and my message box button needs to be okay [Music] and i can needs to be information just close this and just save this start this and i'll go find we have i'm working so let me just show you what actually we have in this table till now here you can see this we have three records for now let me just insert one more record okay so here should name us like what we need to [Music] student semester is and click on this okay and when i execute this once okay and you will find j with the pu here you can see this you can actually match this data here so whatever i have written you can match it okay so this one j use the one zero zero two two seven two second semester contact number first so one small stuff is still remaining and what is that when i try to enter something empty textbox let me just keep this empty and click on this this will generate a runtime exception so why this is because we are we cannot assign and null value to a variable so that's why it's showing an error or we cannot actually insert this null value to the database so for that we have to check that each text box contains some data or not so how to do that for that you have to just go to the experience save let me just copy this much after that we have to write txt department paste this txt department txt semester we have to check for each of the textbox txt mobile so in the else condition we need to write one more step that is message box dot show and i want to write empty and i want to suggest the user and i want this message but it needs to be okay only and after that i can needs to be information okay just put this and save this and just start this you can see this when i click on this and when i try to insert please fill into text boxes so either you fill one it will still show that to show that it will still show that let me see this finally when i fill when i fill this one this will save the data so that's it for today's video guys in the next video i am going to show you this one how to design this form you can see this okay sorry it's a incomplete project we are working on this that's why it's nothing is popped up so let me just move back to this complete project quickly and let me show you all this stuff i have already shown you so if you have not watched my previous video then just go and refer to my previous video so just log in and here you can see this next video i'm going to show you how this will design how to design this all this stuff and how to edit and do everything and this here you can see this uh the data i have added is jpu one zero zero two two each here you can see when i write something it will keep searching like this and when i clear this it's like that okay so that's it guys so just stay tuned and please subscribe to my youtube channel if you have not subscribed and hit the bell icon thanks hello everyone welcome to my youtube channel in this video i am going to show you how to design this view student info form here you can see this when i click on this a new panel is visible and the it's filled with the data already okay so in this video i'm going to show you how to design this in the previous video i've already shown you how to design this student form and how to back in code for this okay so if you have not watched my previous video then just go to description and watch my previous view doctor that you can continue with this okay so let me close this one and let's start designing this form so i'm going back to this library video as you all know we are working with this so first thing what we have to do is we have to add new form so for that just go to solution explorer and in there on project name right click and select add and after that windows form and this you have to name this form i am naming it view [Music] student information and hit enter a new form will be added here you can see this a new form is added so now what i want is i want to make the project similar for that i'm going to just copy the size of this form from this one this is completed project and after that you can see this just go to properties of this form right click and go to proportions and here you can see this i have i'm using 96 and 500 just go to this project and just right click and go to proportions let me just make this large little bit and after that search for size here you can see this and just paste it or you can manually write it here so let me just make it don't increase the width just increase the length of this okay so that it the designing can be simply can be done so first thing what i need to do is here you can observe that the background of this is orange so let me just copy the background color so you can see this back color the color code is this you can just pause the video and write this or follow like i did so just go back to here after that just go to properties and after that search for back color and just mention the color code here you can see this i mentioned the color code and when you hit enter the color of the background has been changed after that i need a panel okay so let me just drag and drop the panel here you can see this and i want this panel to be of white color so let me just change this background to white okay here you can see this let me just copy the size of this panel first go and size of this panel let me just 953 and 131 just copy this just go to the properties of this panel and after that size okay so it's looking nice and after that here you can observe on a small stuff we have a picture box and we have two labels not one we have two i will tell you why we have these two labels so let me add one picture box just go to tool box and search for picture box drag and drop this picture box here like this okay so i have already provided the link of each and every image or icon i'm using in this project just go to description you can download it from there okay so after that i need label so just drag and drop i need two levels just copy and paste so we just change this first one text to add and second one to student and hit enter let me just select both at one time after that increase the font of these labels and change the color you can see this and let me just make it a little bit bold or decrease its size okay here you can see this now change the color to little blue so sky blue or something let me just select this one okay so you can see this now put it like this i will show you why i am doing this and let me set image to this just click on choose image local resources will open your local directory of your computer and after that just move to the directory where you have for your image so let me just select which image actually i want to select is this one search let me just open this and hit open just make this stretchy image here you can see this that's looking nice in this way you have to do okay so you have to make one a small change to this form so that is auto scroll you have to find this here you can see this and make this true i will tell you why i have did this just save this let me add all the required stuff into this project and after that i will explain it so here you can see this we have one label one text box and one button so let me add these stuff so label just drag and drop it one text box just drag and drop it and after that i need one button just drag and drop it change this one too let's go to properties and there you can change this involvement number after that make this text box large and change this button name to refresh and hit enter change the properties of this button so you have to make a small change that is flatter style and you have to select the pop-up that you can see this the color has been changed and as well you have to make the font of this little bit large and bold as well so 10 and bold here you can see this now it's looking nice the same way you have to change the size of this text box so just click on this and make this bold and then okay so whatever is written inside this text box is now of size 10 and it's not obviously bold so you have to increase the size of this level because it's not looking nice and now it's looking nice here you can see this after this what we need to add is we need to a data grid view okay and a panel here you can see that this is a panel so one detected view and one panel just go to toolbox and search for data grid field just drag and drop it here like this and just make it large let me just copy the size of this data review from this one just go to properties you can see the sizes and just go to properties of this data review and i will find the sites okay let me just search for size so you can see this the size and just paste or you can manually write and hit enter you can see this it's auto stretched so now it's looking nice and after that we have observed we have a banner let me add one pattern panel just drag and drop it here here you can see this it's automatically a scroll bar is here so that's why i have enabled form auto scroll here you can see this if i disable this these scroll bars will be removed so let me just turn this here you can see this all the stuff has been removed and then you make true here you can see okay so i hope you understand why i have enabled this auto scroll after that let me just make this form a little bit large so that we can add the panel let me just copy the size of this panel from here just click on this and go to property size here you can see this just copy and just go to this properties and change the panel you tell a location actually so there you can see the sizes just hit enter okay so here we have the panel now so now we have to change the color of this panel so let me just copy the color code so here you can see this 192 comma 255 comma 255 just copy this you can manually write this just click on this report is back color search for by color here you can see this manually right this one 192. here you can see that the color has been changed so till now all the task has been done so so now what we have to do is we have to add few stuff that is uh three here you can see this three uh six labels six text box and three buttons so let me just add these one by one so you have to drag label first just drag and drop it here we need three labels on the left so i'm going to add three labels so here you can see this two and three after that we need three text boxes so text box just copy and paste to replicate so here you can see this after this we need few labels more so here we have to put this copy and paste to replicate after that we need textbook so just copy this and paste okay and after that we need two buttons so let's just copy the button we need three buttons so copy paste paste so here we have three buttons so now we are going to change the name of these labels one by one so let me just check out what is the name student name with all my number and department so this one is student name this one too actually enrollment number this would do department and after that what we have is student it's actually spelling mistake so it's this first student semester student contact student email so let me just change this student semester this one too contact this one to student email okay so we have to increase the size of these levels as well so just select these labels and just increase the size so how to increase the size just go to font and just make this 12 and hit okay you see this after this you have to move these text boxes on the right place there you can see this and after this what we have to do is we have to change the text size of these text box as well so just click on the text box and go to properties and after that you have to change the font so i'm going to make this 10 the same way you have to do for the rest just do it one by one so now we are done with this after that what we have to do is we have to make this text box large like this and we have to put it a little bit right side so that it looks nice like this and make these six boxes large too and after that we have to change the name of these buttons so let me just see update delete and cancel so just change this go to properties update change this one to delete and change this one to cancel okay so you can see this these buttons are not looking that much nice so what we have to do is we have to increase the font of these buttons so how to do that just go to font and just click on this and make this 4 and 12. so no it's not looking nice so let me just change this one to 10 actually and hit okay here because it is looking nice in the same way let me just make this a little bit large buttons okay and change these two just make this 10 and bold the same way you have to do for the cancel button as well just 10 and hold and make this little bit large okay you can see this that's looking nice but it's still not adapting the background color so how to do that for that you have to just go to this flat style and just click on this pop-up here you can see this now it's looking nice the same way you have to go for the rest so now our designing part is done here you can see this this is scroll bars here so what we have to do is we have to make this small okay so when form loads the size of form will be like of this size and we have a scroll bar so that we can actually access the form down here so you can see this but when i start this project and when i click on this nothing is happening why this is because we have not added that form into this button so let me just add that quickly so just go to form so where is the phone this is the dashboard here we have and we have this view stream for just double click on this and a click event will be generated here you can see this after that you have to write the form name that is view student information vs psi equals new view information in this way you have to do and p s si dot show so here what we have done is we have created object and after that okay so we have created object of this form so vsi you can write anything here it will work and after creating object what we have called we have actually called a method show so on that object so that that form will be visible so let me just start this and when i click on this here you can see this you have the form now so here you can see that this is a scroll bar and here you can also but one small step actually one small problem is here that when i click on this this is not in the center so you know how to do that in previous video i've already shown you so i'm going to show that once quickly so we have to change this start position of this form so you can see this just go to properties of the form and change the start position to center screen when you start this and when you click on this here you can see this it's in the center now every time you click this will be in the center so here you can see this when i write something it's in the bold and sizes greater okay so you can see this so let me just show one thing quickly that this is a complete project and let me just start this and just write use an image possible and when i click on this here you can see this when i write something the image changed and when i empty this text box previous images restored so here you can see this one you can see this searching so it search for this student so i'm going to show you how to do this how to actually change this image when this text field have some text or when you remove that image is restored to the previous one so i'm going to show you how to do that so just go back to your project after that what we have to do is we have to go for this text box text change so first let me just change the name of this textbook so what we have to do is we have to change the design name so let me just change this one to search txt search search enrollment so i have changed the design name of this and after that just go to event and then we can see this text change just double click on this and what we have to do is we have to check that if txt search enrollment dot text is not equal to null if it's not equal to null then what we have to do is we have to set the image that searching and if it's in else condition what we have to do is we have to set image the previous image okay so how to do that first thing so we have to do we have to write the code image and create an object for a variable image variable that is i image itself and equals image dot from file and you have to copy the image file where you have stored this just open that quickly so in this pc sorry desktop just go to the folder where you have stored the image which i have provided just click on here and just copy this just move back to your project and after that you have to just paste it here you can see this i have pasted it here and after this you have to write the name file name so actually you have to change one small stuff that is nothing but let me just do that quickly so here you can see this in this folder i'm using this so it's a gif so search dot gif and it's search one dot gif so what i want to do is i want to set search one dot df when the text is not empty text field is not empty so we have this url in this variable so now we have to set this to picture box so our picture box name is nothing but picture box one so let me just show you the name of this picture box so picture box one is a name just go to here and you can see this i have written picture box one dot image we have to set the image and equals the variable name that is image so don't get confused this is a small i not capital i make sure don't do stupid mistakes just start this okay so we have some error so why this is showing an error because we have used this slash you have to change the slash with this slash just reverse this like this and your problem is resolved okay so just to start this you can see this all problem has been resolved and when i click on this here you can see this i write something searching but here you can see this searching add student so what we have to do is we have to remove this ad okay so actually we have did a small mistake so we have to change the label name as well so it's not add you have to actually change this name to view so just change this to view okay so here you can see this when i start this project when i click on this here you can see this when i write something now image has been changed but here you can see this searching view student it's not looking nice what i want to do is when i write something into this i want this view to be hidden and only we have to visible searching student how to do that for that we have to just see the name of this level so this level is actually level one so what we have to do is we have to hide this level so level 1 dot visible we have to do like this visible equals false so let me just start this and put these stuff a little bit more on the right side by mistake i have created a click event for these labels so let me just remove that okay so you can see this now the stuff has been removed so what you have to do is let me just start this quickly and show you because when i click on this when i write something because it's searching this right now it's looking nice whatever what i want to do is when i remove every stuff from this text box the previous image needs to be restored and the value the view also needs to be restored so but here you can see this nothing is happening so that just close this just go back to this code just copy this stuff and paste this stuff here and just make this true and you have to just delete this one from here because this image name is search dot gif so here you can see this now when you start this and when you click on this here you can see this when i write something searching straight when i delete let me say this let's restore to the back page so that's it for the today's video guys in the next video i'm going to show you how to back-end code for this form and how to implement that so just stay tuned and just hit subscribe like and share with your friends thanks for watching hello everyone welcome to my youtube channel in previous video i have already shown you how to design this form here you can see this if you have not watched my previous video then just go to description and check out the video or you can just click on the suggestion okay so in this video i'm going to show you how to design how to back-end code for this one how this button will work and how to actually fill the data with this enter this data grid view here you can see this the task still here has already been done in the previous video so you have to just go and watch that so now i'm going to start with this so first thing what i want is i want to load this data into this form is the in this data grid view and i want to hide this panel so how to do that for that you just close this one first after that what i want to do is we have to just create a form load event so how to create a formload event just double click on this form i have double click here you can see this user information load event is generated and here you have to write one small stuff that is let me just check the panel first thing what we have to do is we have to hide this panel so how to hide this panel so just go to here and just check the design name here you can see this panel too so i have to hide the panel too panel two dot visible equals you have to just set false and just save it and now start this and you will find that that panel is invisible now okay it's taking a little bit of time here you can see this now here because you observe that it's crossbar is missing as well as the panel is also missing so this works fine so now what we have to do is we have to add the data into that data grid view so how to do that for that first we have to create a sql connection object so that for that you have to just write sql and after that you will find a small pop-up here you could see this and just click on this sql data okay sorry it's not like that sql connection after writing this you have to do that so you can see this using uh system.sql.com when you click on that here you can observe this the library is imported without this you cannot use the sql okay so after that we have to create a connection object so sql new sql connection after the creation object what we have to do is we have to pass the connection string so just write like this and after that we have to write data source and then this data source you have to pass the data from your microsoft sql server management studio when you open this you have to just go to file connection object explorer and you will find the server name you have to just copy this for each system this is different so just copy this from your system not just copy the my system server name okay so you have to just paste it here and you have to add one more forward slash here and after that you have to mention the database name database so my database name is library so i'm going to write library after that what we have to do is we have to write integrated security is equals true okay and after this what we have to do is we have to create a sql command so i'm going to create a sql command object that is cmd new sql command and after this we have to pass a connection string to this command okay so connection string object is you and just pass it over here and after that what we want to do is we want to actually fetch the data and show that data into this view this sort of data grid view so how to do that for that you have to pass it command string okay command text actually command text equals and what query we need to do is we have to search all these details so select start from new student table name my table link is new student i have previously showed you and i have created that table if you have not watched my previous video then just go and watch so you can see this when i this code will be executed all the data from this new student table will be stored somewhere where we have to store we have to create a data set for that so that we have to first write the sql data adapter and after that we have to write the equal new sql data adapter and in this we have to pass the command and after this we have to make object of data set like this and then this we have to fill this data set with the value which is in the data adapter so that we put that a dot which value we have to fill is data step so now when this form loads we will the data will be filled and sorry the data will be stored into this data set and what we have to now do is we have to store we have to show that data into data preview so let me just see the name of this data grid view so just go to properties and here you will find the name of this is datagrid21 so you can see this name so just you have to write one small line of code that is data review dot data source equals ts dot tables and we have to write zero because we have only one table in that let's start this and when i they see this when i click on this the data is here now okay so now what we have to do is i want that when i write something inside this one that data needs to be filtered from these records you can see this when i type r a h u l so sorry this is actually the enrollment number failed so i can't filter that i have to filter with this one zero zero when i write this only this record needs to be visible except and remaining all needs to be invisible so how to put that for that let me just go back and we have to write here if text box is not empty we are not going to change any code for this just write recite this okay so let's start with that so first again we have to create the database connection for that let me just copy this code till here okay just copy this code and you have to paste it over here and we have to just one we have to make one small change that is nothing but in this command text query so how to do that so for that we have to actually like like this select start from new student where enrollment number here you can see this uh we are going to filter the records with enrollment number and this user is going to enter enrollment number so we're in draw and actually this in drawl is the table in the table it's a column name here you can see this let me just show you we're going to deal with the student okay so let me just show you select start from student let's execute this and here you can see this and draw is the caller name you have to write that so i'm i've written it here and after that we're in draw and i'm going to use this like after that what we have to do is we have to put the single double quotes and then again like this with this what we have to mention is text from that text box so in previous video i have shown you that textbox name is txt search enrollment i have achieved that name and from that text box what we need is text and after this what we have to do is anything after that will be searched so for that i'm going to use this percent sign and on the basis of this the data will be filtered into and stored into this data set so after that changing what we want to do is the data needs to be changed immediately so how to do that with that just copy this and paste it over here and just save this and execute this just click on this here you can see this when i write pu dash one okay so some error has occurred and an exception handled okay so let me just check this out select start from new student where involvement like okay so let me just start this once again and let me see okay actually we did a small mistake here you can see this we have to put this small sorry single quotes after this percentage okay so that's it now i'm going to start this and check that if it's still work or not so when i write b yeah it's working pu dash one zero zero i'm gonna enter two then you can see this we have two records with two and when i enter one book two here you can see this only one record is here okay so i'm going to write like this here you can see this when i remove the text from this all the records are visible here okay so let me just close this okay so now what i want to do is here you can see this one small stuff is still remaining so that it what is that i'm going to write mu 1 0 2 and if i select all and delete here you can see this now all the demanding reports are still not visible what i wonder is when i delete all the record from this all the data from this text box i want this table is to be filled with the previous data so how to do that for that we have to just copy a few more lines of code and just paste it over here you can see this this else condition you have to paste this one okay so not a big deal you have to just do this just copy this stuff and paste it over here and just check this and execute this when you click on this here you can see this i'm going to write u dash one zero zero one and select all and delete here you can see this now all the records are visible now everything is working fine so now what we have to do the next is when i click on this record the text fields below here needs to be filled with these data here you can see this so how to do that for that we have to first create a cell click event okay so let me just create a cell click event just go over here just click on this data grid view go over here self click event here you can see this this is self click given just double click on this and it will generate a detected with one cell click event within this first what we have to do is we have to extract which row is being clicked so how to do that for that you have to write data if condition data could do dot rows and in this we have to write e this is the object we are going to use here you can see this e dot row index what we want is row index and after that cells and e dot column index dot then this code will be executed okay so after this here we need a variable to store that value so i'm going to take two variables i will explain why we are going to take these two variables so 64 equals row id i have previously used this through id and view books actually so if you have watched my previous video already so you know what exactly i'm going to do here so i'm going to put the value which uh the cell row row value into this pid so how to do that for that first because when i click that value is in the string format so i want to convert that into a integer format so how to do that put that end dot pass and after that we have to pass data will be one dot you can see this we have to just write this one not to worry about that just copy this stuff and paste over here and i want to convert this value to string and this will be passed to b8 let me just add one value here equals five now for that let me add a break point and just start this but you can see this this is the actually four sides four then i click on this okay so input the string was not in correct format okay so we have some error e row and x dot cell actually we have to mention is zero because we have to extract the value from the zero column that is the first one okay so let me show you the database here you can see this this is the first column and i'm going to fetch each data with the help of this sid okay so that's why i have mentioned here here zero so let me just start this once again just click on this here you can see this when i click on this the five will be in row id so that you can see this e id you can see this five is here i'm going to continue this and i'm going to click one more time on four you see this we have four now so it's working okay so now one more step let me just remove this quickly after that after we have the value what i want to do is i want to show the panel below the great data group so for that panel 2 dot visible it was true so let me just start this and see if it's still working or not so you can see this when i click on this now the panel is visible so what i want is when i click on this this panel needs to be visible and all the data from this row is visible into this text fields for how to do that just let's do that okay so after this we have to create a database connection so how to do that for that just copy this code over here and paste it over here after that we have to actually change this query to select star from new student on the basis of pid so we have the value over here so we have to write where sdu id equals it's an individual format so for that just use double quotes and in this you have to write this pi only for that row all the data will be fetched and stored into this data set so now we have the value so if you are worried about what is this stu id but this is nothing but call and name here you can see this stu id if if in your database this column name is different then you can just write that name okay not to worry about that so now we have the data into this data field so what we have to now do is we have to actually put the value from that data set into this text field so before inserting the data into this text field what we have to do is we have to actually change the name of these text fields so let me just click on this and go to properties and in this you will find a name and you have to change your change name here txt name and change this one to txt controlment this one too txt department this one to txt semester let's go to txt contact and this one too txt email i'm going to change the name of these buttons as well so vpn update btn delete and this one to vpn cancel okay okay actually the name spelling mistake i have done here just save this so now all the name has been changed so move back to the coding part and after that here what we have to do is we have to fill one by one value into that text field so before that what we have to do is we have to actually put this row id over here so what is this row id how to put this so row id equals and 64 dot parse and this just write and column is also zero dot two string in this way we have to do so now we have this row value to id value here i will show you it later where i am going to use this this is going to actually work when you are going to update or delete any record so this will use it further just remember this we have assigned roy over here after this what we have to do is we have to actually set this text name for pxts name here you can see this this one this is the text box whose name is txt as name and we have to set the text you can see this and this is how to set the text so ps dot tables and this we have to write zero dot rows we have to mention zero and column is one dot string this way we can set the value so let me just execute this and you will see that name is set when i click on that particular row so just go over here and see this when i click on this now here you can see crowd is here when i click on j j is here when i click on this puja the same we have to do for the rest okay if you are curious to know how the data is stored into this data set let me just show you that so just start this i've added a break point over here and i'm going to click on this and click on this here you can see this you just said you have to just hover mouse over ts and you have to just click on this magnifies class and when i click on this here you can see this the data is in this format table and it's the column format so you can see this in this through id what i have set is zero and zero this is the zero through and zero column so that's why five will be set into this row id when what here we have done is zero and one so this is zero row and one column this is set into this texture so i hope you know how this stuff is working so for the next if i want to set the dollar number i have to set 0 and 2 0 through 0 1 and 2 second column so let's move further with that so just close this after that what we have to do is we have to set this txt enrollment and we have to set zero and we have to set one dot string after that what we have to do is we have to set for txt department dot text equals ts dot tables and this you have to write dot rows zero and this one is two actually i haven't done a mistake over here so we have to set this two and we have to fit this one three dot two string after this we have to set for txt department actually txt department dot text equalities dot tables dot rows 0 and the column before dot 2 string okay so about to set the department is just please semester let's change this one to semester and after this semester what we have is txt contact dot text equals ps [Music] and the last one is txt email dot text equals ts dot tables this we have to mention 0 dot rows 0 and this one is 6. now the task is done over here just save this and when you execute this you will find that when i click on this when i click on this you can see all the records is filled here you can see this when i click on this chair it means this u one zero zero two two civil second you can see this and contact number is also same because all the records are filled properly so now i'm going to what we have to do is we have remaining with the only free stuff that is update delete and cancel so i'm going to show you what how to update this when i click on this update how this is going to work so let me just close this just move over here now to generate a click given for this update just double click on this to generate a click event just double click on this you can see this button update click event is here so now posting what i want is i want the text from that actually i want the data from those text fields into a variable so i'm going to create a variable string test name equals txt as name dot text from that textbox i need the text after that i have this enrollment number so that's also the string type so not to worry i'm going to take a string variable so txt enrollment dot text string after that we have department so department dot text after this we have semesters so txt semester after that what we have is contact number so in the database contact number is in this big end form so we have to convert that into integer formats now to do that for that we have to write this n64 contact n64 dot parse and in this you have to pass txt contact dot text now this will be converted to the 64 format and after that finally we have email txt so now we have the data into the variable so after that what we have to do is we have to actually create a sql database connection so how to do that for that you have to just copy the code and paste it over here and you have to make actually you have to change this query okay so what we have to write is update table name that is set as name here you can see this we have this s name p n roll department semester contact an email so we have to set for one by one make sure you properly write this column name don't make any mistake in this okay so let's just move over here after that what we have to do is we have actually this name into string format so for that just double quotes like this let me just move this aside and then this double plus and we have to write as name this variable okay after this what we have to do is we have to actually end all my numbers so [Music] like this so let me just copy this stuff over here so that our task can be done quickly let me just copy this and after involvement what we have is after dolman we have department tep equals then this we have to write department after dp the problem what we have is semester so we have to write for semester so semester equals like this this what we have to do is sam after semester what we have is contact and email contact this we have to write contact the variable name here you can see that this is contact finally we have email okay so let me check what is the name s email so i have to mention over here as email and after this let me just remove this and what we have to check is where stu id equals this double quotes it's an integer we are going to check this with the help of row i there you can see this here we have this row id i have already told you that i'm going to extract this data from over here and after this one did that record if we are not going to include if we don't include this where this much statement then what we are going to do is when i click on update but all the records will be updated okay so now just start this and let's try to update just click on this and here you can see this you can see this it's in of the puja is actually second generation so let me just try to update this to six i'm gonna click on this okay so we have some error incorrect syntax near equals okay so we have done here with this we have small mistake double equals over here just start this once again and try to update that let me click on this this is the third let me just actually put this six six actually and click on update and just close this form and load this once again here you can see this now it's in the sixth so it's not look that much nice what i want to do is when i click on update then it should ask that are you sure you want to update so how to do that for that we have to write one small stuff that is nothing but let me just close this here you can see this just mark over here if message box dot show data will updated and this message box name will be success after that i want buttons in this message box box button dot key and cancel and this message box i can needs to be okay information actually this is a question so i'm going to write this question and after this what i want to check is that if user cancel pokey or cancel so when user click on okay this needs to be executed so just equals equals dialog result dialog dot okay this is actually going to check and you have to put one more in the last here you can see this now it's looking nice let me just start this and here you can see this when i click on this and when i click on update here you can see this data will be updated confirm if you click on cancel nothing will be happen if you click on ok the data will be updated okay so let's let me just close this okay so now we are we are done with this update button so small stuff is still left what i want is when i click on this update i want this form need to be reload instantly so how to do that so that you have to write one more line over here and what is that you have to write form name first of all that is view student information underscore that's blue defend and this we have to pass to variable is dot this this [Music] and now just save it and just execute it you can see this when i click on this and i click on this you can see this reload reloaded and the panel is visible by itself so now it's working nice the same way we have to do folder delete so we have to generate it click event for this delete okay so the same task we have to do for this refresh button when i click on this form needs to be reloaded so just double click on this button one click if it is generated because we have not changed the name of this button so let me just change the name quickly so first you move this event so this is the event is removed just go look before it is and you have to change this to pdm refresh and just double click on this button refresh click and generate it and we have to just copy this line of code and paste it over here save this and when you start this you can see this when i click on this and when i click on refresh everything is invisible now okay so now we are going to code for this delete button what we have to do is let me just double click on this delete generate click event and what we have to do is we have to just copy this actually you have to just copy this all stuff over here and paste it over here this much of code and we are going to change few stuff that is data will be deleted not it like this confirm just make changes quickly okay so here we have to remove this query and after that what you have to put is delete from new student and where sduid equals nothing but that oid so this is st u id is column name i have already told you here you can see this and only matching record will be deleted okay so here you can see this everything is working fine let me just start this and here you can see this when i click on this and i click on this i'm going to click on delete data will be deleted i want this to be warning just change this question mark to warning okay so just change this one to i can to be what like this just save this and start this when i click on this here you can see this it's warning symbol data will be deleted so let me just add one data quickly and i will show you how to leave that like this semester fifth contact number one one one google id gmail.com save them for data saved just refresh and exit this okay so i'm going to here you can see this the record is inserted and i want to delete this record it will be deleted if i cancel nothing has happened when i click on this and click on okay you can see this data is removed and the form is reloaded so you can see this now delete is also working so what we have to do is we have left with the one click actually cancel event so let me just move back to this and we have to go for this button so just double click on this to generate a click if and here you can see this click event is generated and what we have to do is we have to write few more line of code so that is first this dot close this will close that form and what we have to do is let me just start this and when i click on this and i cancel the form is instantly closed so what i want is it should ask the user that if you want to cancel or not if you want to close or not so to do that so for that we have to just write in the previous way so message box dot show and saved data will be lost and this message box name needs to be are you sure and the message box button needs to be okay cancel as well and message box i can okay message box icon dot warning after that we have to check that which button you just click so i want to check this for the ok button so dialog research salt okay just save this and start this okay here you can see this is when i click on this cancel unsafe data will be lost when i click on cancel the form is still open and when i click on ok this form is closed okay so that's it for the today's video guys the next video i'm going to show you how to design for this issue book let me just show you that quickly let me just move this one over here this is actually complete project i've already shown you how to design these all stuff and next video i'm going to show you how to design this stuff here you can see this when i maximize this all these text fields are large and this move to this right side and when i minimize it all need to be on the previous site so how to design this i'm going to show you just stay tuned and subscribe to my youtube channel and hit the bell icon and just stay tuned guys hello everyone welcome to my youtube channel today i'm going to show you how to design this issue book form here you can see this we have this stuff we have these text box here you can see this we have this combo box here you can see all the books which are available are here okay so i'm going to show you how to design this and here you can see this when i maximize it all the text boxes sizes change so i'm going to show you how to do this in previous video i have already shown you how to design this view student information and how to back in code for this if you have not watched my previous video then just go and watch my previous video okay so let's start with this first let me close this okay so as you know that we are working with library video so i'm going to work on that here you can see that let me start this and show you that here you can see this we are done till here here you can see this and when i click on issue book nothing happened because we haven't code for this so today i'm going to start with that so first thing what i need is as usual we need one form so for that just right click on your project and just click on add and after that click on windows form here you can see this after this what we have to name is issue books because this is the issue book form so i'm going to keep the names similar with their feature so that we can easily identify them okay so here let me just copy the size of this form from this one so that it looks similar okay so i have copied this here you can see we see this 723 and 551 so let me just right click and go to properties and here you can see this just right here and hit enter here you can see this now the form size has been changed so you need to observe one smaller stuff is that here you can see this we have three panels here these are the panels of different colors and the background color is orange so let me just copy the background color first so just click on the background and after that here you can see this this is a color code you can manually write it or you can select from this okay so just right click on go to properties and search for back color so you can see this just write it and hit enter either you can do like this just click on this small stuff web and here you can search for beat okay so it's kind of you beat is little light you can select other color okay so either you can just write this code 255 comma 192 comma 128 so i have used that so after that i need one panel so for that let me just search for panel in the toolbox drag and drop panel and just put it over here and you have to maximize it like this and just change its background color to white here you can see this just click on this and click on white here you can see this after this you can observe when a smaller stuff is that we have a picture box okay so i have to add one picture box and before that let me just copy the size of this panel so just go and here you can see the sizes 683 and 125 just copy this and paste it over here okay so now size is nice and after that we need one picture box so for that and search i will search for one picture box and drag and drop one picture box over here and let me set picture into this so here you can see this i have used one gif like this so i will add that gif so just click on this small triangle layer choose images it will open your system directory just explore where you have put the image where you have stored your image if you have not downloaded my content image and icons which i am going to use in this project just put description and click over there i have provided link for that okay just click on this and after that which image i have used is this one issue book so just open it and click on ok and here you can see this size mode so you have to select stretch image here you can see this and this way you have to make this large so that look nice okay so make it large up and down it will not move out of your panel don't you worry about that okay nice looking knife after that what we have is we have one small stuff that is issue book this is a label so let me add one label just drag and drop it over here and change this to issue both change the text it's issue books and just change its font size okay so let me make it a little bit large and after that search for font here you can see this just click on this okay so it's taking a little bit of time okay so we are here bold and select 14 yeah for it that's nice and after that change its color so that it look nice for color let me select blue highlight okay so that's nice so i have selected the color highlight okay so you have to select this and after that now task till here is done after that we have to add one more panel over here here you can see this we have this panel so let me add panel one more panel so search both panel just drag and drop it over here and we have to place it like this and make it large okay so actually let me copy the size of this panel so that you get aware of that which size i am using 259 comma 368 so just copy this and paste it over here just right click and go to properties and there you will find the size here you can see the size just paste it here you can see this that's looking nice you need to move this little bit upside okay so now it's good and this let me change the background first uh so how to do that for that you have to just go to and search for back color click on this and we have a little bit like this okay so now it's like it's looking nice it's silver color okay so after that what we have is we have one picture box labeled text box three buttons okay so i'm going to add one picture box one level three buttons and one text box so let me do that so first thing what is picture box i have to add so just drag and drop it over here here you can see this after that just click on the small triangle choose image click on import after that which picture is used as this one so click on ok ok and select this stretch image after that what you have to do is we have to make it large so that it look nice here you can see this that's looking nice after that below this what we have is one label and one text box so let me add that one label just drag and drop it over here change this name to just go to properties and search for text and here you have to set enter involvement number hit enter and change the font size so that look nice so let me just change this one to 14 okay so it's quite large so let me decrease the size of this one to 12 okay sweet okay okay now it's looking nice after that what we need is one text box so let me search for text box and drag and drop text box over here and just go to properties and we need to increase the font size of this one too so that it look nice so let me just add 12 and let me just make this one large so 12 is quite large so let me just decrease this one to 10 okay so now it's looking nice and after this what we need is let me just check this out one button and actually three buttons search student refresh and exit okay so just go to toolbox search for button just drag and drop button here and change this name to switch student hit enter just make this one large after that we need to change the font size so just go to font say just click on this and click on bold 10 okay so now it's looking nice and after that you can see this it's not adapting the background color so that's why it's not looking nice so you have to just change one property that is flat style just go to properties of this button after that you have to select this flat style and here you have to select pop-up when you click on this here you can see this it's adapting the background color in the same we have to take two more button that is refresh and exit just copy and paste to replicate here you can see this just right click on this go to properties and change this button to to refresh and this one too exit in the same way we have to change the flat style pop up for the both of the buttons and change the font as well so just change the font to 10 okay so 10 and bold as well for the both of the buttons bold and then okay so now it's looking nice so let me just make this little bit large like this okay so now it's looking nice so our task till here is done so we are left with this stuff so i have to add this one more panel so let me just add one more panel here so in the toolbox search for panel just drag and drop panel over here and just make it large either you can do like this or i can just go and search for an easiest way just go to properties just copy the size just rightly go to properties and this we have to search for size just hit enter okay sorry i have changed the location so don't make that mistake so just go to space and paste it and hit enter just move back this one to a proper position and after that what we have to do is we have to change the background color so let me just copy the color code of this one just go to properties and search for back color here you can see this color code is 192 comma 255 comma 255 either you can copy paste or you can manually write it over here just go to properties and search for back color paste it over here and hit enter now background color has changed so here we have some stuff that is labels let me just count one two three four five six seven so seven levels and seven sorry seven levels and five text blocks this is a combo box and this one is date time picker and one button so let me add these quickly and we have one level here also so let me just add this stuff let me just add this one change this name to student name hit enter and after that just drive one more level change this one to department drag one more change this one to student semester drag one more student contact okay so let me just drag once more just go to properties and search for text and this one to student contact hit enter after that drive one more this one student email and finally be left with one more book name hit enter and this one too book issue date okay so i need one more level here you can see this and below over here we have maximum three books can be issue two is one string this is also a level so let me add these one label more okay so change this text to maximum maximum three books can be issued to one student and we put it like over here and change the font size of this one so just go to font and click on this bold and then okay so now it's looking nice and change the colors open for color we have to make this one to red okay so put these stuff on the proper partition and change the font as well so how to do that for that let me just do stuff like this okay that's looking nice so we need to add text boxes as well so just search for text boxes in tool box and drag and drop it over here and just copy and paste to replicate you need five so three four and five so and i need one combo box just drag and drop it for one combo box and after that we need one date time trigger okay so we need date time to go just drag and drop it over here like this and these are not on the proper position so we have to move these stuff into the proper position with upside like this okay so we have to change the size of these all text boxes or select by pressing the ctrl key and after that you have to just increase the size of these like this let me just decrease the size of this little bit so now it's looking nice so let me just move these stuff a little bit right side okay so after that we have to change the size of these text boxes sorry labels so after that you have to just click on this okay so no actually it's regular and it's size is nine no let me just increase a little bit more so 10. okay so each text box size needs to be of 10 so let me just do that by selecting all the stuff so i have selected all these and after that just click on this and select 10 and hit okay and the size of these all are changed now so let me just move these stuff a little bit in the center okay now it's looking nice after this what i need to do is i want to one button so let me just add one button just drag and drop it over here and after this let me just change the name of this one text let me change the text so text is issue book hit enter change the font and flat the style here you can see this flat style just change is going to pop up and font to them and hold it okay and just make this one little bit large this way you can do like you can do this stuff okay let me just make it a little bit larger and change the font of the stuff so let me just change the font size to 10 and hit ok ok now it's looking nice and just increase at the size of this one like this okay so here we are done but uh we have not connected this with our dashboard so let me just start this and you will find one small issue so you can see this when i click on this nothing happened because we haven't linked that form with this one so let me just link that quickly so just select dashboard just double click on this and just double click on this issue book to generate a click event and after that what we have to do is we have to generate a object of that form so issue book id id equals new issue after that what we have to do is ib dot show okay and what we have to do is we have to actually change the start position of this one so start position change this one to center screen so that when i click on that it open in the center of the screen so let me just start this and when i click on this here you can see this it's in the center but we have smallest stuff still remaining that when i click on this here you can see this nothing has changed all the panels remain same so i want this panel needs to be filled till here as i have shown you previously so how to do that for that just close this one and let me just show you just click on this and go upside and here you will find one stop that is anchor so here you can see this this is anchor you need to just click on this and you have to select one more stuff that is like this one and this one when you click on this it will when you maximize the form it is scattered it will make itself large enough to fill the all remaining space so just save this okay and start this when i click on this when i maximize it here you can see this this panel is now filled with the uh till end but these are not enlarged so i have to do the same for these text boxes as well and for these panels as so let me just close this after that just select this panel and select the anchor property and after that just select the right one because we have to make this large till the right side okay but that's it and for this one just click on the anchor as well and i want this to be filled down so now let me just start this and then you issue book and when you maximize it here you can see this now this is filled till here now it's looking nice i'm going to minimize it it's in the back on the right position and in the right shape and what i need to do is i need to change this text field so let me just do that for that just select all the text boxes at once and after that change the anchor and select these all just check this and start this once again and just click on this and maximize it here you can see this now it's looking nice and all the text boxes are now enlarged so now what i want is these buttons and these labels need to be right here so how to do that for that just close this and just select these two stuff and change the angle for 42 from this top left to top right just to remove one anchor property just click on that it will turn into white it means it has removed so top right why i'm selecting this top right so that because this side is top right if i select the top sorry right down then it will be in the right side corner so let me just start this and when you click on this and when you maximize it here you can see this now it's here so let me just change this property to top right okay so let me just change it according to bottom okay so bottom right when i start this you will find that when i click on this and maximize it it's on the bottom side so that's why you need this is stuff here so you can select the bottom right angle and if you select that right top then it will be on the right top so let me just remove that and move this back to its original position so just save and start and click on this so now it's working fine so that's it for today's videos guys in the next video i'm going to show you how how to back and code for this form so just stay tuned and if you are not subscribed to my youtube channel please subscribe and hit the bell icon and just share with your friends thanks for watching hello everyone welcome to my youtube channel as you all know that we are working with library management system and in previous video i have already shown you how to design this issue booked form here you can see this so if you have not watched my previous video then just go to description there i put the link for the previous video or you can just click on the suggestion on the right side of your screen okay so today i'm going to show you how to back-end code for this form here you can see this when i click on this nothing happens okay so you can see this and here nothing is in this drop down so let's start with that so let me just close this one first so first thing what we need is when i click on this uh this drop down needs to be loaded with the data that is the book's name so let me show you uh in the complete project so let me start this one okay let me start this here you can see this when i click on this when i click on this here you can see this all the book name are available here these are from the database so how to add these values from database to this combo box i am going to show you right now okay so let me just prove this and let me move to this library video so before starting what we have to do is we have to change the name of these text boxes and columns so let's start with that okay just right click and go to properties and after that you have to change this one to txt name change this one to txt department this one to txt semester this one to txt contact this one to txt email this one too px to book or you can set combo box okay right click and go to properties in the same way combo box one so let me just change this into combo box books and let me just change this to the tank that's it okay so we have to also change the button name of this one to btn btn issue book hit enter and this one to pxt enrollment number ext okay and change this button also btn search after that this this one to bt and refresh this one to btn exit okay so now i'm going to add a book name into this combo box so how to do that so what i actually need is when this form loads the data needs to be present in that drop down so where we have to code is on the form load event so how to generate a font form load even you already know that and previously i've already shown you this double click on this form and it will generate a form load event so i'm going to just double click on this here you can see this issue book flow rate is generated so first thing what we have to do is we have to make the connection with the database so how to do that for that first thing we need to make sql connection okay so show error because we have we haven't imported the library so in this same way you can import the library or you can manually write this using system.data.scriptline when i click on this here you can see this this library is imported okay so here you can observe one small change is that the color of this has been changed after that what we have to write is on equals new sql connection and con dot connection is string in this you have to pass the data source data source and data source is nothing but you have to just go to your mysql date servers management studio after that connect object and you have to just copy this stuff the server name each system has different server name so just copy from your system and you have to paste it over here and you have to mark one more slash over here and after this you have to mention the database name so as you all know that my database name is library so i'm going to mention that and after that finally you have to write integrated security equals true now the connection is established after that what we have to do is we have to mention sql command cmd equals new sql command okay after that we have to pass the connection string to this sorry connection object to this sql command okay so connection will spawn and pawn dot i'm going to open the connection so i have opened the connection here you can see this after this what we have to do is we have to execute one query that is nothing but cmd equals new sql command that is what you have to execute this what we have to select is just the name of that books so select b sorry b name this is the column name from new book this is the table name actually okay and you have to pass the connection with the net so that it will execute so i'm going to show you from where i have written this so let me just move back here here you can see this we have created actually a table so the table name is new book here you can see this so this is basically the book uh sorry the table name here you can see this new book and this is the column name let me just show you here you can see this b and it's a capital and that's why i have matured in that way so you have to mention in the same way which i have mentioned okay so let me just move forward with that okay so after this what we have to write is we have to make a object of this sql data reader action data reader and sdr equals and in this we have to pass this execute reader like this now we have the data so what we have to do is now we have to insert that data one by one into that column so how to do that for that we have to take a loop that is while loop okay while sdr dot read so this will uh this loop will form till this sdr from this sdr we read something it means that if we have 10 columns 10 rows then till 10 it will execute after 10 it will read nothing from this sdr this is the sql data reader so after this this loop will stop executing so in this we have to execute this for and i equals 0 and it will execute till sdr dot field count okay so it will execute from zero to sdr field count suppose in this sdr we have 10 rows so it will execute till 10 okay so it start from zero so that it will execute from zero to nine total the value will be ten so after this what we have to write is i plus plus we need to increment the value okay so we have to remove this one because that will not work here okay so now it's looking nice okay so in this now what we have to do is we have to fill the data in the each iteration so for that combobox dot books dot items we are going to add items items dot add and put from where we have to add is from sdr dot get spring you are going to get this string actually so you have to write like this and which string we are going to get is i i is the index value and now after the this we have to do small stuff that is we have to close this sdr dot close and in the same way we have to close the connection so pawn dot close so let me just execute this and let me see that if that combo box is filled with the data or not okay so let me just click on this and here you can observe that the data is filled in this combo box okay so let me just check quickly by adding one more book so let me just add one google that is something okay electronics author name abc publication abc at the rate x y c by z something like this purchase date book prices 5 000 and 20 days 5 and just save book is saved so i have put the book name that is electronic so i just click on that and here you can observe that electronic is added okay so let me just remove this quickly okay so i'm going to remove this just delete this okay so now let me just show you when i deleted the data is removed from this comma box okay so now it's working fine so now what we have to do is now the data is filled in the data box okay sorry combo box so after this what we have to do is we have to search the actually uh search student from this enrollment number here you can see this when i type u0 dash 1001 when i click on this what i need is when this number is valid the data of that student needs to be filled into these text boxes so how to do that so that we are going to uh code on this search button click event okay so let me just generate the click event for that so here you can see this this is the issue book so let me close this stuff okay this book is here so we have to just generate a click event for this search button just double click on this and this will generate a click given so first thing what we have to check is that uh if that text works empty then nothing should happen so txt enrollment number that is enrollment dot text is not equals to null so first thing we are going to check this that if it's null then nothing should happen okay so otherwise it will generate an exception okay so first thing what we need just string eid that is the id from which from where we need this id this id needs to be from this txt involvement dot text okay after this we have to create a sql connection in the same way i have requested shown you so let me just copy this stuff till here actually okay just copy this and you have to paste it over here and after this what we have to do is we have to write cmd cmd dot command text and in this you have to write select star from new student i have written this new student in this this format because my table name is in that format so that you can see this new student and is in capital and s is also in the capital so make sure you don't make mistake in these smaller stuff okay so select the start from new student and after this where we are going to check the enrollment number of that student so where can draw equals plus eid we are going to check that okay so i have put this extra quotes because okay sorry here i have written wrong okay that's what's showing here actually resolved okay so i've put this extra colon here because it says it's in the string format in the database the extra enrollment number that's why okay so after this we have to store the data which we are driving from the database into our data set so how to do that for that you have to write sql data adapter so equals new sql data adapter and in this we have to pass the command after this we have to make the object of data set it has set yes equals data set and now we have to fill this data set pa dot yes that's nice okay so now we have the data into this data set after this what we are left with we have to actually fill this data into these text boxes so how to do that so for that we have to just write like this first thing we are going to check that if ds data set is empty or not so data set you know that the data is stored in the form of table so i'm going to write like this tables dot rows count dot count is not equal to zero okay so if this will not equal to zero then only this quote will be executed in other condition if you are try to assign null nothing into a text wall then this will generate an exception and this will suddenly close your application so now we have the value in this data set let me just add here you can see this i have added a break point here and let me just execute this program when i click on this and then i click you dash one zero zero one and search student now here we stopped and just hover on this data set and after that you have to just go and just click on this magnifies magnificent you can see this view one zero zero one is the normal number and this is filled with the data in the case if you just enter some wrong id then this will build with nothing so i have entered the wrong idea and just click on this and here you can observe that this table is empty so in the case if i don't add this if condition if i don't check that data set is empty or not then we are trying to assign the null value to text box and this will generate a error so that's why i'm going to use this okay so now i hope you got cleared at this point using this stuff so first thing what i want is i want to set the name data set dot text equals tas dot ps dot tables and from which table we actually have only one table so tables zero and rows 0 and which column actually we need and the rows will be always 0 because we have only one row and from that we have to extract the value so what we have to do is we have to change the column name one by one so as you know that this first column that is the zero column is the id okay so that is a primary key so if we don't want that we want to assign the name so first column is nothing but name okay so let me just put this value dot to string just convert that value into string so let me just execute this and show you okay so you can see this when i click on this u dash one zero zero one i'm gonna click on this here this is filled with the low case okay so let me just close this and let's close this and the same we have to assign the remaining value so we have to assign txt department dot text equals ds dot tables 0 dot rows 0 2 dot strength so guys if you're not subscribed to my youtube channel then please subscribe and hit the bell icon so that you get updated with our new content and just subscribe us to support i don't know how you just you have to just click on the red subscribe button right below this video okay so after this txt semester dot text equals bs dot okay okay so we are we actually faced one small problem so let me just start this and i should book pu dash 1001 and when i click on this here you can see this in the department it's filled with enrollment number so why this is happening let me just show you you just add a break point over here okay so let me add a breakpoint over here and just start this and issue you dash one zero zero one and just click on this just go to the test set and when i click on this here you will find that the zeroth row and the zeroth column s id we don't want that we want s name so this is zero through and one column here you can see the zero one this will assign the name this one is zero and one so zero and two so zero and two is involvement number so in department we have assigned the dollar number so we have to skip this enrollment so we have to actually assign three over here and after that four five and six i hope you understand if you don't understand just comment and ask with us or if you face any problem then just go to our instagram account and there you can message directly and you can contact us directly i will reply you as soon as possible okay so we have to change this stuff let me just stop this and let me remove this back point and we have to add three and four over here the same way we have to do for the remaining so txt contact equals sorry text equals ps dot tables okay the same way we have to do for the email dot text equals ts dot tables this one to 6 and convert this string okay and in the else condition if the idea is suppose let me just start this and let me show you one small stuff so suppose that's the one when i click over here you can see this this is filled with the data so now it's looking nice everything is filled in the proper order and you can select the data so now the task is done here suppose what i wanted when user enters some other email id so here you can see this when i click on this nothing is happening so what i want is when i use a enter or the administrator enter wrong uh enrollment number i want these data needs to be cleaned so that for that we have to just add one else condition over here as condition so try to understand one small stuff is that this will execute only when this dataset have valid this data set have some value so understand this clearly so this dataset have only only have value when this eid match into this database okay so you need to understand this small stuff when this eid that is involvement number only match then this data set will have some value and when it has some value this is going to check that this is empty or not so it's not empty then this task is performed and if this is empty then this condition will be failed in that condition this else condition will be executed in this else condition what we have to do is we have to just clear the text fields if it have some data so txt name dot clear txt department dot here after that we have to write txt sam dot clear txt contact we want to clear that too of that txt email dot here and after this i want to show a message that you have entered a invalid involvement number so how to do that for that i am going to use a master box dot show and this i have to write this okay and ballot enrollment number this we have to write error message box button needs to be okay that's it and after that i want a massive box icon needs to be error okay you have to write like this let me just execute it and let me just show you that here you can see this can i write something wrong invalid normal number and let me just add one valid and click on search here you can see this puja and the small stuff is all filled so let me just change this one one service it is low case and so let me just enter something wrong so i have entered with the wrong and all my number i'm going to click on this all text boxes are clear and here you can see this error invert invalid enrollment number so let me just close the sister and here what we have to do is let me just close this so now now our data as well okay so now next what we have to do is we have to hold for the issue box okay so let me just go to this design and just double click on this to generate a click event of this issue book so i have just clicked on this after this what we have to check is that first thing what we have to do is we have to actually check that this text box is empty or not okay so suppose txt name okay so let me just remove this so first thing what we have to do is we have to disable these all text boxes so that no of the this user can actually make changes into this text field so let me just go to this just make this little bit large after that search for read only actually search readable here you can see this read only so just make this enable the same way you have to do for the rest select one go to properties read only make this true because this one too also to read only okay so this one only to change this one to list actually let me just search for the palette probably okay so enable true flat style standard okay okay so let me just check this stock so what we have to do is we have to change the drop down style let me just find that so here you can see this drop down style to drop down list just change this the same way you can just click anywhere on that drop down and that will work properly okay so after this try to understand one small stuff if why i'm going to write this txt name dot text is not equal to null then this quote will execute why i have written over here this stuff if you are trying to understand just focus on the stuff what is going on so let me just make you understand what is this okay so here what i have done is i have made this text box read only when a user enter only valid uh enrollment number then this text box will be filled with the data so if that text box is empty then this issue book will not work this but it will not work and if this text textbooks have some data then this issue we can issue a book on that involvement number okay so before we are going to code further what we have to do is we have to execute one query to create a table so that in that we have to assign the value okay okay sign these uh records okay so let me just move back to this database and here you have to execute this query you can just pause the video and you have to just manually write this or you can just go to description and copy this table from this query from there okay so what i have done over here is i have just written over it is create table and this is a table name that is ir book that is issue and return book basically here i have given an id that is auto incremented and it's a primary key and it's not null i have added a constraint so here what i have written this td enrollment entirely number is this in the vacant not null student name where can not null department not null semester not null contact that is begin not now in previous video i've already explained you why this is big end in the place of end i've already explained you okay so this is student email where i get not null book name where cat not null issue date market not null and here you can observe one small stuff is that book return date where get 250 and it can be allowed it except null okay because at the time official we cannot fill the return date okay so that will be filled and the place of the date of return okay so you have to just execute this stuff i hope you have excluded this and now i'm going to code for the further just move back to this video and here you can see this let me just go to this event and after that here what we have to do is here you can observe one smaller stuff that maximum three books can be allowed to a student one student so what we have to do is first what we want to do is we want to actually search how many student how many actually books has been adopted to a particular involvement number so from where we have to code for this is we have to code for this and the search is student button so click on this and over here so here i'm going to write one more code few lines of code over here so what is that just add so that it this will actually look nice and you can immediately identify that [Music] has been issued on this involvement number so here what we have to do is our sql connection is already done here so we are going to use that so we have to actually change this stuff so let me just copy this and paste it over here and we have to take one variable that is nothing but a account variable so i'm going to take this upside here okay so added a count over here you can see this and let me just right change this stuff that is select count is a uh actually a function in sql uh this count is not this okay so i have to write this count and within this we have to what we have to count is std underscore enrollment from table that is issue and return book third and all the number is where std we are purchasing this enrollment number name sd d and draw and the eid and and we have to check one more condition that is book return date okay so if you have not understood what i have written over here don't worry i'm just going to explain you small each stuff don't worry about that so here you can see this uh it's showing error so let me just resolve this because you may get confused with this okay so this is showing error so not to worry about that you have to just add one okay so one over here and that's it this will work fine okay so now you can see this all the error has been resolved so now i'm going to explain what the hell is going on over here so i'm working with this okay so let me just execute this once more and let me just show you so can i execute this here you can see this it's the lots of data so what we are going to do is we are going to actually count that select count std enrollment number okay so in this table what we are going to search is count this student name a student involvement number okay so we are going to count the student number which is inserted into that text box search text box here you can see this in this text box we are going to take the value from this text box and from this where enrollment number is this till here you have understood okay so after that what we have it added is and book return date is null so that what is that book return date is null it means that if the user has not returned the book then only this return date is null so it means that if user uh suppose a user has uh taken or issued three books so there will be a three null row with the return date okay so i hope you understand this stuff so here you can see this with the a look here and okay so you can observe one smaller stuff is that i'll look here you can see this is here our look is here and alok is here because if it's in three rows to return it is null so we cannot issue book to this aloo because it's already taken out three books and it haven't returned if it returned one book then this return date will be added and then he will be eligible to take one more book okay so here we are actually checking that he has not returned we are going to check here that how many books he haven't returned so we will find that it's three then this will not give any book to that student so now we have the value into this data set so i'm going to assign that value to this count equals end and we have to convert that into parts integer type so d s one dot tables zero dot rows dot zero zero dot and just convert this to two string like this okay so we have some errors over here so we have to actually mention this okay sorry sorry so we have to replace this stuff okay dh1 dot tables.000.2 string and now this will be now this count have the value how many books actually the student have checked in okay so after this now we have just we are going to use this count here not to worry about that so in this first thing but we have checked that txt name should not be empty after this what we have to do is if combo box dot combo box books dot okay select index selected index is not equals not equals minus 1 and and count is greater than or equal to two so this is the variable which in which we i have actually assigned the value okay so this is the count and with this we are going to compare here here you can see this we are checking to condition so first thing that combo works needs to be selected and the second condition the count should be uh greater than or equal to sorry we have written wrong here less than or equal to two because we have to count the zero one and two so three books are here you can see this let me just add one message box okay dot show hello i am in and just take this and just start this i'm going to show you why this i have written over here just click on this okay so when i click on this here you can see this u dash one zero zero one zero zero two okay so suppose i haven't clicked over here and nothing is over here so when i click on this nothing happen so i'm going to just click on this and here you can see this when i click on this nothing happened till now because i haven't selected this combo box and i'm going to select this one and when i click on this hello i am n because first thing first condition is that this text box needs to be filled and second condition is that this combo box needs to be selected so now when i click on this this will work fine so i hope you understand what is going on over here so let me just remove this quickly and after this what we have to do is we have to take the value from each text box so for that we have to create variables string and txt name dot text string department equals txt department dot text sam okay so we have a normal number name department and semester enrollment number name department semester after that contact email book name and book issue date so after semester what we have is contact number so contact number is an integer format so 64 contact full and 64 dot pars and this we have to write txt contact dot text after this we have to write this string email equals txt email dot text string after this we have book name equals combo box that's a combo box comma box books dot text finally we have issued it so string book issue date equals the tank picker okay okay daytime picker dot text so now we have the value into the variables so after this what we have to do is we have to insert this value into database so we have to make the sql connection for that let me just copy this code let me just copy this code over here and just paste it over here and after that we have to actually change this line of code let me just copy this code from my completed project okay so i'm going to paste it over here and let me just explain you all the stuff okay this is actually extra that's right okay so here what i have done is insert into ir book this ir book is the name of the table which i have created here you can see this i artwork and after this this std this stuff is nothing but this is the column name here you can see this okay so let me just make this little bit small so that you can observe one of small stuff is that steady indoor number the first column name after that steady name the same way i have done over here i started normal study name make sure that you follow the same sequence just pause the video and write this line of fourth after this in these column name i have mentioned the column name here you can see this one two three four five six seven eight eight over here so let me just move back one two three four five six seven eight we are not going to insert the return date that will be the separate module okay so i'm going to show you that later okay so i have sorry we have written the column name over here and after that we are going to insert the values into that for values enrollment number in draw we have written the variable over here you can see this this is selected now the same way we have to do s name department semester contact follow the same sequence don't change the sequence just pause the video and write like this okay here you see this single quotes and double quotes enrollment single quote double quote s name for the contact only we will have this double quotes only here you can see this we have this double quotes plus plus and contact because it's in the big end format it's in the integer format that's why for the string we have to write like this comma double quotes plus sam double quotes comma okay so let me just move the layer over here so now just pause the video and write everything okay so i hope you have written over here so now i'm going to move further so here you can see this so now when you execute this query this will actually done the task i'm going to uh here you can see this we don't need this data set because we are not getting back any data from the database so let me just remove this stuff with this spawn dot ooping you have to open the connection and let me just remove this stuff from here okay after this what we have to do is we have to write this command execute non-query okay skew not query here we will find this just and after this we have to write this connection we have to close the connection because we have opened that and finally okay so you can see this error has been resolved and after this what we have to do is we have to show a message that book had been issued master box art show book issued okay and let me write this message box name success after that message box button needs to be okay and this message box needs to be i can have some icon so message box i can and which i can we need is information we are giving information that has been issued now task till here is done suppose if this column uh combo box is not selected then what uh the stuff we want to show to the user that the else condition here you can see this if these two conditions satisfy this code will be executed otherwise it goes to else condition in else condition i'm going to show one small stuff let me just copy this code and paste it over here and let me just change this stuff so here we are going to check to condition that is either the book is not selected or you have issued maximum books okay so i'm going to change this stuff so select book or maximum number of book has been issued and just change this to no okay so let me just start this and let me show you that if it's working or not so for a loop we have seen that already three books has been issued okay so let me just check the our loop involvement number so our local environment number okay so our look has been removed from the database okay so let me just issue for some new student that is uh location okay pu one zero zero one u dash one zero zero one and just click on it over here here because it's gonna click on this select book or maximum number of book has been issued okay so let me just select the book oops and just issue book issue here you can see this let me just close this stuff and open this stuff once again you attach okay 100 location let me select one more java so both book issued the same way i'm going to do one more u-1 0-1 and select and php so here here you can see this now we have selected the book name but still it's showing this but why because now uh this location has already been issued with the three books one in previous time while i'm coding and two i have turned right now in front of you okay so now here this code is working fine okay so now let me just move back to the code and here this condition is done so what i need to do is here you can see this if text box dot text is not null if it's null then we have to also show one information okay so okay so we have to actually change this stuff here this is a error so let me just change this one to error okay and after this for this if we also have to mention one else condition this i'm going to show one message box message box dot show enter valid involvement number and message box name needs to be error message box button dot okay and message box icon needs to be added so let me just start this and show you what this was done so here you can see this when i click on the search button so nothing happened when i click on this enter a valid enrollment number because it's empty okay so let me add something and it should book indented valid involvement number okay so because we are checking that if the data set is empty if this text box is empty then this will show an invalid and all by number here you can see this let me just close this so here we are checking that uh the text box name is empty okay so not should be empty so that one did that will only turn when our conditions satisfy and that textbox is filled with the data so that's why it's showing that into a valid normal number so we are done with this issue book so now we have to code for what you have to code for actually this one the external menu this one text box if it's null then all these data needs to be cleared so let me just start this and when i issue book and suppose i have entered you dash one zero zero one and hit enter let me see this when this when i delete this now it's an invalid enrollment number so what i want is when i delete this these data needs to be removed from here so how to do that for that we have to code on this text change event of this text field so just right click and go to properties and just click this one events and here you have to find text changes double click on that and we are going to change that if pxt enrollment dot text is equal equal to null then what i want is i want to actually delete the data clear name dot clear as well so now just start this i have set the condition that if text box is null then only clear the text boxes so let me just add view dash one zero zero one and just enter here you can see this now it's filled with the data so i'm going to remove one by one and when it's clear everything is removed so now it's working fine so now it's looking better than before so now one small stuff is still remaining what is that so that we have to code for this this one okay so let me just see we have to code for this refresh button so what i want is when i click on this refresh button everything on the display is needs to be clear so i'm not going to write a very large code for this program i'm going to write a very small simple line of code so for i just try to understand what i have said is when i clear this text field when i clear this and all my number all this text field will be empty so on this click button i want that this textbook needs to be cleared when this textbook will be cleared all the data from this will be removed so just double click on this to generate it click event and in this i'm going to clear this dot here and for that text box if that text box is empty then this will clear all the text box so in short i'm using this code with the help of this so let me just start this and show you is that working or not here you can see this view dash one zero zero one and when i click on this here you can see this the text is filled with the data so when i click on this you can see this all the stuff has removed because i have said this none so if this is null then the all the data has been needs to be removed so now it's working fine so we are remain with this exit button so how to do that what i want is when i click on that exit button this form is stupid close so double click on this and you have to write this dot close that's it just start this and click on this here you can see this that's working fine so what i want is before closing it needs to be show it needs to be asked from the user that if you are sure you want to exit so for that you have to just write message box box dot show are you sure and this needs to be icon something warning so message box sorry button needs to be okay or cancel and i want this message box and i want this message box icon needs to be warning and we have to check that if user enter okay if you use our enter click on okay then only this code needs to be performed so it's because it was dialog dot result title dot okay so here we have check that condition so now let's start this okay so you can see this when i click on this when i enter enrollment u dash one zero zero one and when i click on this everything is working fine and when i click on this are you sure you want to exit are you sure if i cancel nothing will happen if i click on here okay so this will close the form okay so now it's working fine so that's it for today's video guys in the next video i'm going to show you how to code for actually how to design this return book so let me just show you quickly that the completed project this one is complete so let me just write this ready and password okay so in the next video i'm going to show you how to design this form here you can see this e dash one zero zero one so for location let me see this now location as i have shown you that location is the shoot with the three books that's why i can't able to issue one more book so here you can see this so i'm going to just show you how to design this in the next video so just stay tuned and before you leave the channel you need to subscribe and hit the bell icon so that you get updated without your content and please subscribe and share with your friends as much as possible so thanks for watching hello everyone welcome to my youtube channel in previous video i have already shown you how to back-end code and how to design this form this is actually issue book if you have not watched my previous video then just go to description or click on the suggestion on right side of your screen okay so in this video i'm going to show you how to design for this return book here you can see this runner enter enrollment number that is one zero zero two and when i search it here you can see this for this enrollment number all the books which is issued to this student are visible here when i click on this here you can see this we have option to return the book when i cancel now this form is in the reset state okay so first we are going to design after that we will code so let's start with the designing part before starting if you have not subscribed to my youtube channel then please subscribe and hit the bell icon so that you get updated with our new content okay so as you all know that we are working with library video so here we are in this project okay so first thing what i need to do is we need to add a form so for that just go to solution explorer and right click on your project name and you have to select the add option and after that you have to just click on the windows form when you click on windows form a form like this will be open and here you have to keep the name for this form that is nothing but return book and click on add it will add a form in this way we have the new form here now what i need is i want this form of the same size as the previous one so let me just move back over here and just right click on this and go to properties and here let me just copy the size of this form so here we have just copy this and just go to properties of this and just paste it over here to search for size here you can see this and hit enter not this form and the proper size after that i want the background color also needs to be same for that just go to properties and search for background color here you will find this let me just copy the color code here you can see this the background is orange so in the same way i am going to copy the background color so this one is here just copy and paste it let's go to properties and in this back color you have to paste this 255 comma 192 comma 128 and hit enter now the background color is orange after that you observe one small stuff is that we have one panel this is a data grid view and this is another panel so let me add these stuff here you can see this this is a scroll bar so for that you have to enable one property that is auto scrolling of your form so what we have to add is one panel one data tube and this is one another panel let me add that quickly so first thing i'm going to enable the auto scroll so here you will find this auto scroll you have to make this true okay so this will uh the scroll bar is functional later i will show you that don't worry about that just turn this through for now let me add one panel so here you can see this i'm searching for panel just drag and drop it over here and after that we need to change the color of this too so let me just change the color just go to properties back color change this one to silver like this okay and let me just copy the size of this let's go to properties okay so color code is a little bit different so let me just leave that size just copy and just go to proportions and after that paste the size 259 comma 368 hit enter now it's in the proper size let me change the color a little bit more so let me change this one too okay so now it's looking nice in the same we have to add a data grid view just search for data grid view drag and drop it over here and just make it large like this okay and after that what we need is we need one panel and below over here so i have to add one more panel so let me add that just drag and drop it but you can see this here you can observe one smaller stuff is when i added a panel here you can see this scroll bar is now visible here you can see this so when you turn that feature on then this will happen automatically you don't have to worry about that so let me just copy the size of this panel so just go to properties let me just scroll it down a little bit so that you can see so let me just copy the size here you can see this 702 and 141 so just go back over here and go to properties and after that change the size okay so now we can see this so make this panel of the same earth so now it's nice and change the color of this okay let me change the color of this panel same as this one so for back color the color code is 192 255 and 255 so i have copied the color just go to prepare this and that color just paste it and hit enter so now we have the form is ready now we have to add the stuff into this and this panel so in this panel what we have is let me just check that out so first thing what we have is one picture box and one label text box button and these two buttons more so let me add these stuff so first thing i need to add one picture box so just drag and drop it over here just click on this choose images local resources as i've already told you that i have provided the link for all images and icons i'm using in the description just go and download it over here and if you have not subscribed then just please subscribe and hit the bell icon so okay so i'm going to click on this important with open a local resources of your computer and just explore where you have put the image okay so i'm using this image over here just open it and hit ok just make this stretch image okay so now here we have the image now just make it large as per your requirement or as it look good after that we need one label so let me just drag one label here just drag and drop it just go to properties and change the name of this to enter enrollment number so change this one to hit enter after that we need to change the properties of this one so just go to properties and change the font change its font to it's taking a little bit of time so change this one to 12 okay so now it's looking nice after this what we have is we need one text box and one button let me add text box so just drag and drop it over here you can see this just make it large and just go to properties and increase its font to eleven and hit okay so that's looking nice now let me just move this little bit down and now i need one button so just search for button in toolbox now drag and drop the button over here and just go to properties and you have to change your stuff that is first thing you have to change this flat style from standard to pop-up and after that you have to change the font to bold and 10 hit ok after that you have to change the text that is search student hit enter and you have to make this button little bit large like this okay so now it's looking nice oh size of this has been decreased okay so let me increase that size just click on this go to font search 12 okay so now it's looking nice after that i knew two more buttons so let me just drag and drop quickly and change this style to so this one is actually reset button or refresh and this one is exit okay so we have to change the font and this flat style as well so first change the flat style to pop up and after that change this font to 10 volt and hit okay the same we have to do for this one too change this one to bold and 10 and hit ok let me just increase the size of this button a little bit okay in the same way two for the second one so now it's looking nice so change this one standard flat style to pop up okay so now it's looking nice here now we have this similar panel and now we have to design this one panel below over here and here we have to add few stuff that is let me just show you three labels and two text boxes one daytime picker and these two okay let me add that quickly so we have to add three labels so first let me drag and drop the few levels that is three levels just copy and paste to replicate and after that i need two text boxes and one eight times bigger just copy and paste to replicate and after that i need one date time picker just drag and drop it over here and after that i need few buttons that is buttons just drag and drop it i need to just copy and paste to replicate and let me just give them a similar look okay so let me just change the name of this one so just change go to proportions and search for text and then you have to change this to book name and this one to book issue date hit enter and this one too change this one to book return date editor and now we have to move this little bit right side okay so it's moving with the label so i have to drag this one by one okay that's looking nice and let me just increase this size of this text box similar to daytime picker okay and let me just change the font of these levels just click on this 12 okay the same we have to do for the remaining labels useful properties search for font and increase the size to 12 okay so here you can observe that now it's looking nice and the same if you have to change the size of this text boxes as well so 10 just to make this 10. one also to 10 and finally we have to change the design of these buttons so let me just change the name of this one to let me just see the name of the button return and cancel so this one to return and this one to cancel cancer okay and now we have to change your properties of this button so first thing what we have to change the flat style so change that flat style to pop up the same way to for the second one and after that we have to increase the font size of these buttons as well so just click on font and just increase that to 10 and hold as well so you can see this now it's looking nice 10 and hold okay so if you want to give them a nice look so you can actually change the back color of this button just change the back color of this cancel button to a little bit red so that it looks nice okay so you can see this now it will look nice so once the stuff is remaining that let me just make this short here you can see this pin user click on that data grid view uh after that this is visible okay so okay so it's quite small so i have to make this this much okay so now it's looking nice so you can see this the panel will visible like this after that user has to scroll this panel okay so now we have to connect this form our form is ready we have to connect this form with our dashboard so you can see this when i start this and when i click on return book nothing happens so i have to connect it with that so how to do that for that just go to dashboard and just double click on this return to generate click event just double click on this and after that you have to make a object of that that is returned book the panel name that is return book return book rb post the overton book and rb dot show you have to use the method and when you start this you will find that now it's visible because i'm going to click on this here you can see this okay so that you can see this when i drag this this is the red color is looking nice okay so this what small stuff is still remaining that this panel is in the not in the center when i click on this button here because it's not present in the center so i have to hold for that so we have to change a little bit stuff that is just go to properties of this panel and after that you have to change the start position of this panel here you can see this start position and click on this and you will find the center screen now start this and now when you click on this this panel start pop up in the center of the screen okay so i hope you like the video so just that's it for today's video guys thanks for watching please subscribe and hit the bell icon in the next video i'm going to show you how to back and code for this form so stay tuned and just support us thanks hello everyone welcome to my youtube channel in previous video i have already shown you how to design this form this is a return book form and you can say that this form look like this if you have not watched my previous video then just please go to description and check out the video link or you can just click on the right side suggestion on your screen okay so in this video i'm going to back and code for this because here you can see this when i enter something like this nothing happened so i'm going to code for that so how these all buttons are functional how do these buttons will work okay let's start with that let me just close this because of course let me increase the size of this because it's not that much nice so let me just increase the font size to 10 hit okay okay so after that what first thing what i want is when i enter something into this and when i click on this search button this data grid view needs to be filled with the data of that student okay so for that first thing what i need is button click event so first let me just change the design name of these stuff so how to do that for that for just go to proportions and after that change the design name so for that just search for name and here you have to change this one too txt enrollment enter and draw and after that changes button name to btn search student [Music] and this one to btn refresh and this one to btn exit and the same we have to change for these also so change this one to txt book name this one to book issue date ext book issue date and we have only one date time because so we don't need to change that just change the design name of this button so vtn return and change this control pt and cancel okay so now what we have to do is uh actually i'm not changing the name of this data to because we have only one data grid view okay so first thing what i need to do is we have to generate a click event for this button just double click on this and click event is generated here you can see this so first thing what we have to do is we have to make a sql connection so for that sql connection and after that you will find a small pop up here in the right side sorry left side blue and here you can see this just click on this this will include the library import the library and after that you have to just make a connection as your connection object so new sql connection after this you could pass the connection string so and this you have to write the data source and equals you have to copy that from your actually database so let me just open that quickly so it will take a little bit of time so don't worry about that so i'm using this microsoft sql server 2012 management studio as you all know that you can see this when you open you will find the server name you have to just copy this and you have to paste it over here and you have to mark one more forward slash and after that i have to mention the library database name so for that strike database and here you have to mention library because my database name is library you can put your database name if you change that library and after you have to type integrated security equals true so make sure you don't make any spelling mistake that will cause an error okay so after this what we have to do is we have to make a sql command object cmd equals new sql command and in this command we have to pass the connection string object sorry connection object sql connection so cmd dot connection pulse on after that what we have to do is we have to pass the connection string sorry command string command text action so in this we have to write select star from ir book that is my table name in previous video i've already shown you i've created that when i have designed the issue book okay so here you can see this okay let me just show you quickly and just connect this and let me just change the stuff okay so it's taking a little bit of time so not to worry about that so let me just change this one to library okay so you can see this select star from ir book and just select this one and execute so you can see this my table is here so it means that my table link is actually ir book okay so you can see this then null represents that book has been issued but not returned okay so i'm going to show you that so my table name is our book and here what we have to do is we have to only select those records which match the enrollment number of the student so from where we may get that normal number here we have to extract that value from the text box okay just close this stuff you can see this we have to extract that value from this one this text box and i have changed this name of this text box to txt dot enter and draw so select start from iron book where we have to find that and all my number let me just find the column name of that so column name of enrollment number is std involvement std underscore and draw so you have to write the same if you have mentioned any upper case then you have to write that in the upper case so don't make this small mistakes okay so where std underscore and raw and here we have to mention that it's actually in the string format so that's why we have using actually single quotes and then double quotes and this we are actually concatenating with this okay so txt and front turn draw and from this textbook what is need is text so we're checking that select star we have to select all the records from which table ir book where enrollment number is this which is user entering in the text feed and after that we have to check and book return is equal to null so here you can see this what let me just show you what i'm doing here let's see this book underscore return date this will null only when the book is not returned so i'm going to check that condition too so just write this column name over here so book underscore return underscore date is okay so now i hope you understand if you not understand this comment in the comment section or i will just explain you right now so we are checking actually here to condition select a star from iebel still here you understood and after that what we are checking that first thing that in student development number is this and whatever is written in the text box this one okay so let me just write it over here okay till here suppose user enter pu dash one zero zero shift one zero zero two and after that we are going to check that and return day is no this is the condition okay so if the book is returned then why we need to return that if this is not null then then that record will be not visible in the data review this is going on here let me just remove this if you still don't get it then just text or not on instagram or you can just comment in the comment section i will definitely explain you and i will definitely make something other stuff for that to make you understand okay so not to worry about that so now after this what we need to do is we need to actually store the data which are we are driving from the database so sql data adapter da equals new sql data adapter and this we have to pass the command cmd of command object and after that what we have to do is we have to create object of data set ps equals new data set and this after that what we have to do is we have to fill this data set so let me just fill this with dot sorry ds in this we have to pass it data set object and now the task is done over here okay so after that suppose if user enters something wrong user id sorry wrong enrollment number we need to do something for that so suppose when user enters royal environment number it means that this condition will fail this will return nothing null it means that data set is empty so what we have to do is we have to check that if okay so let me just add a breakpoint here for now and i will show you how to do that for that let me just add a breakpoint and how this stuff is going i'm going to explain you that okay so i will start the project and here you can see this when i click on this return book pu dash 102 when i click on search student okay it's taking time okay something exception occurred additional information and network related okay so i have made some mistake over here so let me just resolve that quickly okay so i have used here comma in place of colon so let me just replace that with the colon and let me start this once again turn book pu dash one solution two when i click on this here you can see this now we move over here the breakpoint it means that this code is successfully executed after that let me just see the data set here you can see this when i click on this only those records are visible whose return book is empty here you can see this okay so now let me do one more stuff that is let me just enter the wrong enrollment number so i have entered the wrong number number when i enter so here you can see this this data set is empty okay so let me just write code for that to check that okay so you can see this what we have to do is we have to check that if the data set is empty if not null then only the data could be visible okay so tables and in the zero dot rows and dot count is not equals to zero then only we try to fill the data grid view if we try to fill the data grid view with null value suppose user enter the wrong enrollment number then the data set contain nothing and when we try to assign nothing into the data grid view then that will generate an exception in your program so we need to check that for sure so data gradient name is data group of one dot data source data source equals ps dot tables and in this we have the path zero because we have only one table and here you can see this when you start this and when i click on this here you can see this when i enter view dash one zero two okay here you can see this now we have the record so if i enter something wrong here you can see this nothing happens so let me just put this code outside this if block so that you can see the difference okay so let me just start this so i'm not checking the that the data set is empty or not so okay so when i enter some valid user id then it will work fine and if i enter something wrong and when i click on search nothing happens okay here you can see this okay so here you can see this the same way we have to do for let me just put it back and here what i want is when i user enter wrong i want to show a message that you have entered a wrong environment number or no book has been issued so here we have to just put an else condition and in this we have to write the message box dot show and valid id or no book shoot and after this we have to make this mark this text box oh sorry message box as error then give the name this error and after that message box but it needs to be okay and i can needs to be error dot error let's close this and just start this once again here you can see this when i click on this and when i enter something wrong invalid id or notebook issued so now it's looking nice better than before in the previous condition i have shown you when i enter some wrong and normal number then this data is filled with some data which is empty table nothing but an empty table so that's doesn't look that much nice so it's saying that this book is not issued or invalid id so let me just enter a valid one you dash one zero two one and when i enter this search student it's not looking nice so next what we have to do is when this form loads i want this panel links to be invisible here you can see this now for now when i uh start this when i click on this you can see this for now this panel is visible what i want is when i use it enter semitone and have a valid normal number after that when user click on that row then this data needs to be filled with that data so i want first thing to in hide that panel so for that we have to put on the form load even just double click on this and what i want is we need to hide that panel so let me just check the name of that panel so just go to properties and this name is panel 2 so i want this panel to be hidden so panel 2 panel 2 dot visible equals false let me just start this and when you click on this here you can see this now the panel is visible and the auto scroll bar is also disabled okay and we have to add few more lines of code over here i will explain you later why i have added that so i want to just close the actually clear this involvement field when it's load okay so that's it after that what we want to do is i want to code for nothing but so we have to code for data review cell click event search go to properties of this one and you have to just click on this event here you can see this we have to select the cell click here you can see that this one is selfish just double click on this and it will generate a cell click and detect it with one underscore self click event here we need few variables so you have to take these variables to extract that value from that row and reach the user click so first thing i needed string type that is nothing but book name and string type nothing but update and we need one integer and 64 that has row id okay so we have created three variables over here and after that i'm going to write something so first thing what i need is when i click on that data grid view that panel below the panel which we have hidden here you can see this on the return book load event this panel visible first thing i want to show that panel so panel two dot visible equals true i have to do that let me just start that and show you that if it's still working or not return book pu dash one zero zero one because there is nothing no panel is over here and search it and when i click on here you can see this now this panel is visible okay now it's working okay so now we have to extract the values from the clicked row so how to do that for that first we have to check the condition directly one dot rows [Music] and then this we will use this object e dot row index will extract the index dot cells okay and in this we have to pass that e dot column index dot value not need to be null okay and after this if it's not null then what we need to extract these data so how to do that for that first i want to extract the row id so that's actually in the integer format so we have to pass that value to integer to convert that value because whatever the text is in the string format so we have to convert that into that integer format so for that in diesel 64 dot parse and in this method we have to use data graph1 dot rows e dot row index dot cells 0 dot value dot 2 string so here you can see this what we have done is from data grid 1 row and we have selected that row index and from that row index from that row we are extracting the zeroth value because zero is always our column actually the primary key that is the id of that here because here in the database you can see this is the zeroth column and this is the id ignore this because that's of the database so we have to see this id here you can see this so that is the zeroth that's why i've used zero over here you can see this okay so we have to actually extract the book name and book dates so for that we are going to use the id book name is here too this one is 0 1 and 2 this one is 2 and ok ok this is not actually a book name this is student name here we find the book name so zero one two three four five six seven this is the seven and this one is eight book issue date here you can see this this one is book issue book date okay so we have to copy okay actually we have to copy this much stuff because it's already in the string so we don't need to pass that so for that b name equals and paste it this and after that we have to change this one cell to seven as i have counted it right now and after that we have that put date and we have to paste it and we have to change this stop to eight so after now we have the value into these variables so now what we have to do is we have to set these values to the text boxes here you can see this we have two text box book name book issue date and these this needs to be selected by the user okay so we have to set book name and book issue dated with these two text boxes how to do that so for now let me add one breakpoint over here and just start this and see if we click on that row we get that data or not okay let me just 1001 and when i click on this search student now you can see this the book name is data structure and book issue dated monday 20 so just click on this and here the provide is 18 okay and after that book name is let me just hover on this one book name is data structure here you can see this and when i hover on this monday april 2020 so now it's working okay so now we have to assign this value into these text boxes so still you can see that these six boxes are empty so let me just stop this and let me add the stuff for txt book name the text box name dot text and this we have to set the text that that's the variable b name and in the same way we have to do for the issue date issued dot text and that's in the book date so now when i start this and then i enter involvement number and when i click on this here you can see this books and it's on the friday may 15 20 20. you can see this oops friday may when i click on this data is changed here you can see the data structure so now it's working fine so now the task is done till here so now what we have to code is we have to code for the return book button so let me show you that so you can see this when i click on this return book i want to return only this book okay so let me just go for that for that just go to your form and just double click on this return book to generate a click event just double click on this and after that we have to make again the sql connection for that we have to just copy this line of code and just paste it over here and after this what we have to do is we have to actually update so i don't need these stuff so let me just remove this and after that first thing what i need is connection dot open we have to open the connection and after this i want to pass the command text so command text what we need to do is we need to actually here because in the database we have this null value so we have to only update the return date into this okay so this empty column so how to do that for that you have to just write update table name that is ir set book underscore return underscore date equals plus date time picker date time picker dot text from this we need the text close it's in the string format so this is actually the table name and this is the column name here you can see this book underscore return and underscore date so i have written it over here and we have to check that the condition that which id needs to be uh which involvement number and what is the id row id okay so we have to check the two condition where std underscore enrollment equals needs to be matched with the enter txt involvement entertainment dot text to be matched with the user which user has entered and after that we have to check one more condition if only we execute the query till here then it will return all the book which has been issued to one student at a single time so for that we have to actually check that which row has been clicked which row has been selected and only that needs to be returned for that i'm going to check one more condition that is and id equals and id is in the integer formats of plus rho y d so i have extracted this true id from here here you can see this okay let me see this row id and i've extracted this through id over here so only that worry needs to be returned okay so let me just double quote over here so now it's fine i hope you understand this if you don't understand then just comment and i will just explain you what is going on over here after this i have to write one more thing cmd dot execute non query and we have to finally close the connection close and after this what i need to do is i want that when i user return a book that form needs to be reload okay so how to do that before that just you have to do like this return that is the actually this uh form name that is return book underscore load we have to call that so this one here you can see this and in this we have to pass to stuff that is this and when you call this this will reload the form this will call this uh form here you can see this this will call this and this will do two tasks first thing is that this form the panel over here needs to this will be invisible and this textbox will be cleared here i have called that load method over here and after that before that what i need is i want to show a user confirmation that your book has been returned for that we have to write message box dot show and in this you have to write return success full and this master box needs to be named success and needs to burn off okay and after that we need icons so message box i can dot information and now it will look nice let me start this return book you dash one zero zero one and search here you can see this four one zero zero one one little three books has been issued so now i'm going to issue one more book for this one you dash one zero zero one and search student and i am trying to issue one book here you can see this maximum number of book has been issued so let me just close this and go to return book and fill you one zero zero one and search student and i want to return this book okay so this one here you can see this this book is nothing but data structure or let me just return this java box which i have selected that row and here you can see this when i return only that record needs to be returned so that is 26 and the book is java on me 25 so i'm going to return that when i click on this okay so some exception occurred in valid column std enroll here you can see this app make a small mistake i've already warned you for this don't make this mistake so let me just change this std and draw here you can see this if it's control let me just check that std where it is std underscore e and r o double l and our audible now just fine so let me start this once again and i'm going to u-131 and search student and i'm going to return this one so that's java so when i click on ok this form loads and this text works is empty and here you can see this okay so we have to mention one more thing that is we have to actually read actually this call this search button because this panel you can still find that we have three records over here this is because we have already that data from the previous okay so let me just here you can see this now we have only two records one book has been returned that is the java this machine over here so now it's working okay so now after this what we have to do is we have to do code for the few remaining buttons that is nothing but refresh exit and cancel button so let me code for that first thing uh one more stuff is remaining that first text change even for this one so if this is null then what we have to do is we have to set this data grid view to null but it means that no value to this uh data grid view and our problem one more problem will be resolved here you can see this currently i have shown you that when i click on return and when this return this detect review is filled with the previous old data so that will be resolved so let me just go to properties and in this search for text change event just double click on this and this form will load and check the condition if txt enter and roll dot x is not equals null and if it's okay sorry if it's null then what we have to do is first thing that panel needs to be invisible panel two dot visible equals false and second stuff that is i want to set the data grid view but nothing just empty so for that data source equals null i have to set that okay so let me just start this and i will show you what actually did we hear what we did it over here so here you can see this u-1001 when i click on search student here you can see this we have this record and i'm going to return one more book so in the previous time where you can see this when i click on that return this data is still over here so this time this will not here because we have said that when this text box is clear the data from this needs to be removed okay so let me just retain okay here you can see this nothing is over here and this one is also empty so i'm going to show you once again so you can see this when i search for this only one record is still remaining okay so let me just do this now it's working fine after that what we have to do is we have to code for this refresh button just double click on this and refresh button click advantage and create it and in this we have to just we have to do nothing we have to just clear the text box because on the text box clear we have to clear this text box because all the tasks has been done on this text box we have to play smart so txt enter enrollment dot text sorry dot clear we have to use that okay so here you can see this now it will work fine or not just start the project and return book here you can see this one zero zero one and search student and here you can see this everything is now okay sorry pu-1001 and when i click on this and when i click on this here you can see this everything is there and when i click on this refresh button so now here you can see this the form is refresh okay so now it's we are left with one move button that is nothing but exit button so just double click on this and i just button click given generated and here we have to do one small stuff that is nothing but this dot close this form will be closed and one still one button is remaining that is cancel so and the same way on the cancel button also we need to do the same stuff over here just copy and paste it or we can do one small stuff that is panel two dot visible equals false so that will look nice okay so let me show you dash one zero zero two and search student and like click on row and i click on cancel okay here you can see this now it's looking nice okay so now we are done with this return book so i hope you like the video and if you like then please subscribe and share with your friends and hit the like button so in the next video i'm going to show you nothing but the complete book details here you can see this this is a complete project password is pass and just enter i'm going to show you how to design this complete book detail you can see this all the book which is uh currently for issued and re return book you can fetch all the data over here the today date is uh something it's sunday sunday may 17. here you can see this i have returned two book that is of low case so the first one is java and oops here you can see these two records are visible and all the issued book are visible over here so in the next video i'm going to show you how to design this panel how to run this form and how to code for this access button so thanks for watching please subscribe and hit the bell icon before leaving this video okay so thanks hello everyone welcome to my youtube channel as you all know that we are working with library management system and in the previous video i have already shown you how to back-end code for this return book and i have already shown you how to design this form okay so if you have not watched my previous video then just go to description i have put the link of the previous video or you can just click on this suggestion on the right side of your screen so in this video i am going to show you how to design this complete book details here you can see this all the books which has been issued is visible and all the books which has been returned is also visible so i'm going to show you how to design this and how to back-end code for this so let's start with that so as you know that we are working with library video project so in this first thing what you have to do is you have to add a new form so for that just go to solution explorer and right click on your project name and after that click on add and select windows form in this you have to write the name of the form that is nothing but let me check it out complete book details so write it over here and hit enter so here you can see this a new form is added now so i want the size of this form of same as the previous one okay so let me just copy the form size so complete book details and you just copy the size of this just go to proportion and after that search for size here you can see this let me just copy this and paste it over here so just right click and go to properties and in properties you have to find size here you can see this size is one zero seven six comma five five one and hit enter okay so that's nice looking nice and i want the color code of this one as same as this so let me copy this color code of this form as well so back color search for back color and you have to write five one nine two and one two eight okay so let me set that back color here you can see this so just paste it okay here you can see this when i have set this background color the color is already changed now what i need to do is i need two label and two data grid view so first label is nothing but issue book so let me just change the text of this one okay so shoot book hit enter let me change the font size of this one so just search for font and click on this small dots and after that you have to just increase this one to bold and 14 okay and let me change the color so for color and select this one and in the system you will find highlights okay so you can see this okay after that i'm going to add one data grid view search for data grid view and just drag and drop this one and make the size of this data review same as in the complete project so let me copy the size of this data grid view so here you can see this size is one zero three six comma two zero eight so i am going to set the size of this data it will add same as that one so search for size and let me just paste it over here and hit enter so now it's looking nice here you can see this in the same way we have to look for the return book so i'm going to copy this to stuff and paste it once again and here you can see this and let me just change the name of this one okay so this is actually returned book okay return book okay so now our task is done till here for the designing part what now what i want is i want to first link this with the database okay and fill the data from into this data view before that i want to link this form with dashboard so let me just go to the dashboard okay so it's loading now it's loaded so what i want is when i click on this complete book details i want to open this form for that just we need to generate a click event for reading a click event just double click on this and this will generate a click event after that you have to make your object of that so let me just create a complete details cd it pulls new complete book details after that you have to use one method that is cbd dot show on the object of that and after that what i want is when this open it needs to be open in the center for that you have to change the start position of this form so just go to properties and change the start position to center okay and save this so now let me start this okay so it's taking time okay so here you can see this when i click on this now our form is visible but still the data is not present in the directory view so now i'm going to fill the data okay so we have to generate a form load event for that just double click on form and this will generate a form load event here you can see this after this what we have to do is we have to create a sql connection and here you can see this is small pop-up here because we haven't used the imported the library so just click on that and when you click on this here you can see this library is imported after that you have to create the object so con new sql connection and after this we have to make a connection string so for that you have to write the data source equals and you have to copy the data source name from your just go to your mysql okay and here you will find one small stuff just go to file and click on this connect to server and you will find this just copy the server name and just go back to your project and after that paste it over here and you have to add one more slash okay after this what you have to mention is database name so database name database equals my database name is nothing but library after that you have to write integrated security equals true make sure t is capital okay so don't make any spelling mistake just be sure about that after this what we have to do is we have to create object of sql command so sql command cmd equals new sql command in this command we have to pass the connection object so con and after this what we have to do is we have to execute the command text into the sql so for that select start from my table name is ir book where book underscore return underscore date is null okay so what i'm doing here is i am selecting only those record which return date is null okay so it means that whose return date is null that book is issued but not returned so it means that this data needs to be filled into a data grid view of issue book so here you can see this i hope you understand what i am trying to explain you if you don't understand then just comment in the comment section i will explain you or you can directly text us on instagram okay so you can see this after this what we have to do is we have to make sql data adapter da equals new sql data adapter after this we create object of data set bs equals new data set and now we have to fill this data set autofill okay okay we missed something here you can see this i missed ps over here and now let me check that if it's working or not let's start this and click on this okay so invalid operation exception occurred in this system.user the select command property has not have been initialized before calling for okay so let me check what actually i did a mistake so i haven't used command over here so you have to mention that cmd and now i'm going to start this once again and check that if data is filled and this issued book or not so just click on this okay so it's not filled because now we have the data into the data set but we haven't assigned that value to data grid view so i'm going to assign that so data grid view one so first data grid view name is nothing but let me just close these stuff and here you can see this just go to properties and here you can see this data group of one and we have to set that data source equals ds dot tables in data set that data is in the form of table so i'm going to assign that table to data source data review okay so let me start this one again and here you can see this when i click on this now the data is filled inside this issued book okay so here you can see this and the book return date is empty so we are filtering the data of the issued book and return book so we have to do the same for this return book so i'm going to do that so what we have to do is our sql connection is already done over here so we have to repeat this line of code so i am going to write that so cmd dot command text text equals select start from ir book where book underscore return underscore date is not null after this what we have to do is we have to create a sql data adapter object so yeah we can't give them the same name so i'm going to write da 1 equals new sql data adapter and in this we have to pass the command so cmd after this we have to make one data set object so data set and ps1 equals new data set after this we have to use d a so don't make object mistake okay so make sure you are writing the correct stuff after this now we have the data into this data set one so we have to assign that into second data grid view so data grid view to dot data source okay so data source and here you have to write ds1 dot tables and just look like this okay i'm going to start this you'll use this when i click on this here you can see this everything is now visible all the student book is currently present here and all the return book are here so that's it for today's video guys i hope you like this video and please hit subscribe and hit the bell icon and hey in this video we have finally completed the project so thanks for watching and please subscribe
Info
Channel: BTech Days
Views: 98,530
Rating: undefined out of 5
Keywords: library management system windows form, library management system, library management system project, library management system in c#, create library management system in c#, library management, library management system project in c#.net, how to create library management system in c#, library management system in c# with database, create library management system in c# with database, library management system c#, library management system c#.net
Id: YhAwNITpnno
Channel Id: undefined
Length: 418min 22sec (25102 seconds)
Published: Tue May 19 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.