Hi. how to copy one form to anoter project?
i right click on project name and choose add existing item. i select one form from another project(all 3 files: .cs, .Designer.cs, .rsex) but it dosn't work.

Recommended Answers

All 2 Replies

Some people have other ways but I have had problems doing it any way except this way. Assume we have two projects: "Source Project" and "Destination Project". The source project contains the form we want to copy to the destination project.

In the destination project create a new form with the same name as the form we want to copy. After we create the new form add a "ContextMenu" to the form and save the solution. Adding the context menu forces the .resx file to be created and associated with the form.

Now close the "Destination Project" and open up windows explorer and delete the 3 files for the form: form.cs, form.designer.cs, and form.resx. Copy the file from the source project to the destination project.

Open up the 3 files we just copied inside of the "Destination Project" with notepad and change the namespace ____ line to reflect the namespace for the "Destination project"

It sounds complicated but it takes less than one minute once you are familiar with it.

Also had some issues with this sort of thing. Thanks for the tip Scott.
Renaming is also a tricky thing to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.