How to : use an existing form in another project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay hi um in this video we will see how we could uh copy a form in one project and use that form with its code in another project okay so basically we have this form and let us make some changes okay let's call it test okay and let us place a button over here okay this will be click me okay and the code is going to be MSG box hello okay hello Universe okay so basically um this is a very simple application okay so we click that and this is Hello Universe okay so we have this application now we we want to use this same form okay in another project so here I'm am going to start another project and now file new project and uh okay so now we have uh we're going to call this uh Windows application 35 okay so the thing we want here is that we want to add the other form uh that is created in the previous project now this is what you need to do uh I'm going to put these two windows one next to each other okay so we have these two windows now when you click on this form here you check its property this is the location so you copy that okay you uh you go to the folder now if you pay attention you'll find it uh you are getting the full PAAD with 41 PB remove form one. VB from that okay or whatever the name of the form is press enter and there you go you get the directory of your project uh the files that describe the form and contains its code are three files form one VB this one contains the code form one. RX is one contains icons images Etc and form One designer. V which contains the definition of controls on the form and stuff like that so uh you copy these three files so we we just uh we're gonna minimize this for now okay so now we you want to put that in your new project again you select this one to get to the correct place okay um this is another window and it is going to be something similar okay now we are going to encounter a problem here uh if you look at these two you'll find here it is called form one and here it is called form one this will cause a problem so what you want to do you make sure that the form here is changed for example form two okay now you rename the the file and also you rename the class okay obviously all the references here will be updated to the new name so if you are running a program you might get get the code not working because of this change so just be careful with that now why did we do that this is because here we have uh the form name is form W form one and in the other project you also have this form which contains exactly the same name which is form one these names will conflict and uh your project will be corrupted okay so now after we change this and we save this one uh we minimize this okay so now you see that it is form two so you copy these wait a minute copy these files and paste them over here okay so you got your files now in here now if you go to your project and right now we want to add the second form so here right click your project select add select existing item and a doll will appear all you need to do is selecting the three files of your form and select add and the second form will appear there it is and if you double click it you'll find the code okay um so if you want you can for example here on form 2 do show dialog and and this is form two and I click here and lello universe so this is basically how you can copy uh the forms from one project to another again quickly the uh the idea is very simple make sure that there will be no naming conflict first and second you you click on the form or module or the class copy all the um copy the path or identify where the that form is okay and then copy the files maybe one file maybe multiple files depending on the on the type here the forms usually uses three files and put it here in in the destination folder or your current project folder finally you right click your project select ad select existing item and you select the files that uh that uh describe your form and that's it okay
Info
Channel: mkaatr
Views: 100,689
Rating: undefined out of 5
Keywords: visual, basic, programming, how, to, learn, reuse, form, project, another, study
Id: FPBMoibAmU0
Channel Id: undefined
Length: 7min 0sec (420 seconds)
Published: Sun Jan 30 2011
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.