I have some form/vb in another project that I want to import to a new one. There are three files with these extensions - .vb, resx, and designer.vb. Which do I copy and how exactly?
Select Visual Studio menu Project -> Add Existing Item... Then select (browse) in the file dialog the Form. cs (Form = name of the form) you want to add to the project and the form (with all associated files) is (copied and) added to your project.
Add the project from which you want to import form to your solution, by right clicking on solution > Add > Existing project menus. Select the project and click OK. Now right click on the form you want to copy, select copy. Right click on the project where you want to copy and select paste.
If you are copying the files outside of Visual Studio (e.g. in Windows Explorer) you need to copy all three.
But working in Visual Studio you only need to copy the base .vb file; the .designer.vb and the .resx will be copied for you automatically. How to do this? Right click on your project file in Solution Explorer and choose Add -> Existing Item.
You need to copy all the files. You should even be able to open two instances of Visual Studio and drag and drop the form from one to the other.
Once you do the copy you'll probably want to change the namespaces and/or type names inside the files because they might be pointing to names from the previous project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With