Reputation: 2169
I want to copy a Form from one WindowsForms application in a Visual studio 2013 solution to another solution. How should I do that. I have tried copying files to the target solution folder and adding them using Rightclick -> Add Existing Item but the form dose not show any thing in new solution.
I'm so grateful for your precious time. Your helps would be appreciated in advance.
Upvotes: 1
Views: 50
Reputation: 2169
I finally found the solution. One way to inform the VS to connect the designer and main files together in case they are loading separately is to exclude them from project and to close the V.S. and after reopening V.S. the form files should be included again in project.
this solved my problem. I hope this would be helpful for others.
Upvotes: 0
Reputation: 18767
You should only add cs file to the project. Other files (designer.cs and resx) will be added automatically.
Sometimes those files load separately. Try to build the project. And then wait for a minute or so. It may take some time.
Upvotes: 1
Reputation: 3797
You should copy 3 files of the form itself (code, designer-generated code and resource file) in the target project's directory:
Form1.cs
Form1.Designer.cs
Form1.resx
And everything else form depends on, like user controls, assembly references, etc.
Then, navigate to the root of target project in the Solution Explorer, press 'Show all items' button on the toolbar, locate your Form1.cs
file in the solution explorer, right-click on it and choose 'Include in project'.
Upvotes: 2