Search code examples
c#winformsvisual-studio-2008duplication

Making a duplicate of a form in Visual Studio 2008 (C#)


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?


Solution

  • 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.