How do you add an existing form to a new project?

后端 未结 21 2214
予麋鹿
予麋鹿 2020-12-13 09:06

I have never been able to successfully add a Form from an existing file to a new project.

I read on a blog that you add just the *.cs file and the depen

21条回答
  •  余生分开走
    2020-12-13 09:31

    Assume that you want to import a Form called YourFormName. Then you should only add YourFormName.cs to the project - the rest parts (YourFormName.designer.cs and YourFormName.resx) will be added automatically.

    steps:

    Create WinForms project (in my case .Net Framework is 4.5.1) in VS2013 Right-click on projects -> Add -> Existing Item... copy winform you want to import to the folder of your project. If you want to add it to a new folder then first create a folder then add. Search for any WinForm with controls (I added two forms created in VS2010 for .NET framework 4) in lesser than 10 sec visual studio added all the remaining files and i can open this in design mode.

提交回复
热议问题