vb.net 复制要在同一项目中使用的表单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37048489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Copy A form to use in the same project
提问by Beldi Anouar
I need to have 8 forms of the same format within the same project
我需要在同一个项目中有 8 个相同格式的表格
I dont really want to specifically place all the buttons etc in each of them
我真的不想专门将所有按钮等放在每个按钮中
Is there a way i could copy and paste the format and then change all the button names etc?
有没有办法可以复制和粘贴格式,然后更改所有按钮名称等?
The program is a flight booking system so for different flights on the same plane type i need multiple forms
该程序是一个航班预订系统,因此对于同一飞机类型的不同航班,我需要多种表格
回答by Abdellah OUMGHAR
To duplicate a Windows Form, you have to do these simple steps :
要复制 Windows 窗体,您必须执行以下简单步骤:
1- Open the folder project in File Explorer.
1- 在文件资源管理器中打开文件夹项目。
2- Copy the three files, .vb, .Designer.vb, .resxof the form that you want to copy.
2 -复制三个文件,.vb,.Designer.vb,.resx形式要复制。
3- Rename the files with the name you want.
3- 使用您想要的名称重命名文件。
4- Open the file with a text editor for example Notepad++.
4- 使用文本编辑器打开文件,例如Notepad++。
5- Modify the Classname in the .vband .Designer.vbfile.
5- 修改和文件中的Class名称。.vb.Designer.vb
6- Include those files in the project.
6- 在项目中包含这些文件。
Below an example demo :
下面是一个示例演示:
回答by Beldi Anouar
Ok you can do copy past from your form1 ,a form CopyOfForm1 shoud be created .
好的,您可以从 form1 复制过去,应该创建一个表单 CopyOfForm1。
- you change name "form2" instead of "CopyOfForm1"
- Change name of class "form2" instead of "CopyOfForm1"
- In CopyOfForm13Desiner.vb you must also change name of class "form2" instead of "CopyOfForm1"
- 您更改名称“form2”而不是“CopyOfForm1”
- 更改类“form2”的名称而不是“CopyOfForm1”
- 在 CopyOfForm13Desiner.vb 中,您还必须更改“form2”类的名称而不是“CopyOfForm1”
Have a look at this Gif picture :
看看这张 Gif 图片:


