How to easily duplicate a Windows Form in Visual Studio?

前端 未结 14 1434
梦谈多话
梦谈多话 2021-01-30 21:03

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?

14条回答
  •  日久生厌
    2021-01-30 21:22

    • Save the all project
    • Right click in the Solution Explorer (SE), "Copy"
    • Right click on the project name in the SE (this is the first line), "Paste". It will create a "Copy of .....vb" form
    • Right click on this new form in SE, "View code", and change its class name to the name, that you wanna use for the Form
    • Left click on the new form in SE and rewrite its name for the one, that you used in the class name (and .vb in the end)
    • Build - if it has no error, you win! :)

提交回复
热议问题