I have a form in my existing project.
My current task is to make a duplicate of an existing form and change few things on the new form. Making a copy of the form cs files would not do since the existing contents themselves refer to file information.
Simply put, I am trying to crate a form name MyNewForm, which will be a direct duplicate of MyCurrentForm without causing any naming conflict that may arise in mere copy pasting of code content.
What is the fastest way I can achieve this?
To copy a form from one VS2013 project to another, the easiest, (fewest mouse clicks) is: In your target project, right mouse click on your parent folder (likely your project) and in the menu select, "Add; Existing Item". Then select the form's cs file in your source project.
Copy the form in visual studio solution explorer. Rename it. And change the class name manually both in .cs and .Designer.cs files. Do not use VS refactoring feature as it blows away references to the original class.
To duplicate a form (in the same project):
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With