What is the best way to copy or cut/past a form from one Project to another Project within a Solution in Visual Studio?
Whenever I try it, using the solution explore
If you want to forms in same machine then simply you can do this.
In Solution Explorer Project --> Add --> Add Existing Item.
Select only .cs (Sample.cs)
file from source directory and Refresh the current solution Explorer it will Work.
For Visual Studio V.12 this is the only method which worked for me (It is a mix of above entries):
I have tried the below steps and its worked fine.
I am using Visual Studio 2010, below are the steps I performed:
I finally figured out as followings:
1) copy 3 files of your wished form whose file extension are .cs
, .resx
, .Designer.cs
.
2) Add Existing and select formName.cs
.
3) check the namespace and Name property value of the added form.
4) In Program.cs
file, use using NameSpace;
and replace new NameSpace.formName()
in the line of Application.Run()
.
Figured it out - knew it would be something daft.
Apparently the target project should have the references:
included within the project FIRST before you do any copy or pasting or else you will get the problem I described.
Thanks for anyone who tried to help BTW.