现在,设计器生成的代码都被存放在TestForm.Designer.vb文件中,你可以点击解决方案浏览器工具条上的Show All Files按键来阅读这个文件。你不应该修改这个文件中的代码(实际上你是可以修改的,只是不推荐你这么做,涕淌注),但是,如果你想在设计器文件被再次生成时保留下一些东西,你可以把需要的代码复制粘贴到TestForm.vb文件中。
Partial types allow definition of a single type across multiple source files. The type definition has a normal declaration in one file: Public Class TestPartial ''''implemention... End Class
In other source files, you use the Partial keyword to tell the compiler that this code is a continuation of the original class definition: Partial Public Class TestPartial ''''implemention... End Class
Code in classes generated by designers in the IDE is marked with the Partial keyword, and is separated from user code. Add a form named TestForm to a project and look at the resulting source file. You may be surprised to see that it''''s empty except for the form''''s class declaration. Where''''s all the designer-generated code that used to go inside the Windows Form Designer Generated Code region?
The designer-generated code is now placed in file TestForm.designer.vb, which you can see by clicking the Show All Files button in the Solution Explorer toolbar. You shouldn''''t change the code in this file, but you can copy and paste what you need into the TestForm.vb file if you want to preserve something when the designer file is later regenerated.