Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET 2008 importing forms from another project?

Tags:

vb.net

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?

like image 877
Alex Avatar asked Jan 10 '10 05:01

Alex


People also ask

How do I import a form from another project in VB net?

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.

How do I copy a form from one project to another in Visual Studio?

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.


2 Answers

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.

like image 118
hawbsl Avatar answered Oct 20 '22 18:10

hawbsl


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.

like image 41
Eilon Avatar answered Oct 20 '22 19:10

Eilon