Resolved Copying Win form from one VS2019 project to another

CopperKettle6

Member
Joined
Dec 8, 2020
Messages
7
Programming Experience
10+
Can't figure out something you think would be easy - it was back in the old VB6 days. In VS2019 want to copy an existing Windows Form from an existing project to a new project. When using 'Project | Add Existing Item' The code copies but the form design does not and errors out when you try to execute. Any ideas?
 
Solution
When you select the existing item to add, the system should recognise the form and import all three files. Is that not happening in your case? Please provide some screen shots of exactly what you're doing and exactly what happens in the Solution Explorer and the project folder in File Explorer. This has always worked when I've done it so I can only conclude that either you're doing it wrong or your VS is broken.

Another option is to use drag and drop in the Solution Explorer. If you open the destination solution, you can add an existing project and select the source project. This will not copy or move the project folder but just add it to the other solution in place. You can then drag the form from one project to the other in the...
When you select the existing item to add, the system should recognise the form and import all three files. Is that not happening in your case? Please provide some screen shots of exactly what you're doing and exactly what happens in the Solution Explorer and the project folder in File Explorer. This has always worked when I've done it so I can only conclude that either you're doing it wrong or your VS is broken.

Another option is to use drag and drop in the Solution Explorer. If you open the destination solution, you can add an existing project and select the source project. This will not copy or move the project folder but just add it to the other solution in place. You can then drag the form from one project to the other in the Solution Explorer to copy it. Once you're done, just remove the source project from the solution again. This shouldn't be necessary but, if adding an existing item the usual way isn't working, this may get around that problem.
 
Solution
Thanks so much for your advice. Adding the old project to the solution of the new project worked great as far as being able to transfer Windows Forms.
 
Back
Top