How can I easily duplicate a C#/VB Form in Visual Studio? If I copy & paste in the Solution Explorer, it uses the same class internally and gets messed up. How do you do it?
Just rename the class the designer references.
But a better solution is to create a new instance of the same class at run time.
Or better yet, create a parent form that various implementations inherit from.
I'm generally averse to methods of doing this that involve opening up the files in notepad or whatever, since I always think a common task like this should have a built-in way of doing it in Visual Studio. In this case, there is.
1.Add a new folder to your project
2.Copy the form into that
3.Change the name in properties as well as change the file name
4.Check each form for their class name (they shouldn't be same)
If you're working in VS 2019, take a few minutes to create an item template -- it's a perfect solution. How to: Create item templates
Not sure if it applies to earlier versions of VS.
I have been using another way of copying forms since vb6.
comments welcome.