How to Navigate through(Change) Forms in Windows Forms application C#( Move from one to another form

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi guys today i'm going to show you how to navigate through forms in windows forms application so i'm going to create a new project then select windows forms template rename your project and create so guys this is what you get when you first open your project so now if you want to add another form you go to your solution explorer so here's my solution explorer hover over your your solution then right click go to add then select windows forms you can you can change the the name of your of your form if you want to but i'll just leave the default values just add i want to edit the third form go to your solution explorer right click over solution go to edit then add windows phones okay now we have three forms now if you want to change the back color of your phone you go to your phone properties then here click pink color then change the way same applause to form two if you want to change the color go to pick color foreign so now our forms have different colors now what we need to do we need to add buttons to that will enable us to to navigate through our forms so you go to your toolbox then add pattern so guys this is form tree right in form tree you are going to have two patterns the first pattern uh will take you to form two this will be previous party and then this one will be exit because we have three forms if you are in form three it's either you exit or you go to the previous form which is home too so let us name our patterns so i'll call this one so it's by to inform three previous then change the text to previous then go to this one and then name your party chain form three next then change the text to next okay let's go to our phone tool in form two you need to add two patterns the first one will take you to form one then the second pattern will take you to form3 go to your toolbox buttons so this one will be our previous pattern so name your pattern form to play for previous then go to your text and change your text to previous this one will be our next party next then change the text to next now go to your form one so in form one there is no previous pattern because this is the first form when the application load you are not going to go to the previous page or something the only option you have is to go to the next page or next form so you are going to add to one button so go to your toolbox then there is the button this is your next pattern then name your party then change the text to next so we have all patterns in all of our forms now let us code this pattern so the behavior if you click this button double click then when this button is clicked right you want it to close your phone one then open from 2 so we are going to say this dot height so this method guys what it does it actually closes the active form so the active form is is easy is form one so you are closing form one you want it to to to show the home to so in order to show form2 you need to create an instance here's how to create an instance of home tool then this is the object name this is an instant name you can just take the such a state names or or type your own name so i'll just take the form to name that twice such a state to me and say form2 don't show so this is an instance guys so you hide the first form then you show the second form if this next button is clicked so we are done with form one now let's go to phone two so let us go first code the previous pattern double click so if the previous button is is clicked you wanted to close form 2 right then show a form 1 because you're going back to the form 1 previous form so you are going to say this you don't hide your hiding form too then create an instance of the form you want to show well in this case we want to show form one right so we are going to create an instance of form one then i'm going to take form one such a state name and say form one would show right then we go to the next party on phone 2 double click now when this button is clicked you want it to hide the form 2 then show form 3. so we are going to save this and hide then create an instance of form3 right and take your subject name from three and then form three dot show so now that our patterns both of our patterns have coded you go to your form 3. now in form 3 if this previous button is clicked you click you want it to close from three then go back to form two right so we are going to say this at height this is the method to hide your phone then create an instant of form tool because you want to show formula then say form tool dot show now let us code our next party yeah here we made a mistake right this is the exit but not next party so let us rename our pattern this is exit there is no next form after form 3 right so let us change the text to exit exit so this is how form 3 will look like then code your your pattern double click now if this button exit is clicked you want to close the application so you're going to say application dot exit okay now we have coded all of our patterns in phone one phone two and four three now let us run the code next so this is next form three now let us see if the these buttons are functioning [Music] let's see the previous tattoo say day it takes us back to to the home to previous form one next from two from three and let's see now if you if you want to to change the starting position of your phone like okay let me show you you go first your phone then go to your properties start position center screen and go to start position change center screen start position center screen now your all your three forms will start in the same position so let us start the end see this is your center position right form one is in the center position form two same position form three the next center position then exit so that's it guys thank you for watching guys i appreciate you
Info
Channel: CeeJay_VIII
Views: 404
Rating: undefined out of 5
Keywords: VIII, CeeJay_VIII, C#, Windows forms, Winforms application, Forms, Navigate, Change, Move
Id: 2o6XUb7tTwA
Channel Id: undefined
Length: 16min 31sec (991 seconds)
Published: Tue Sep 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.