Partial Classes

Starting from Visual Basic 2005, you can split the definition of a class across multiple parts using the partial classes feature. You do not actually create different classes; you simply create one class implemented within multiple parts, typically across multiple files. This feature was first introduced for separating Visual Studio’s auto-generated code from developer’s code but it is useful in different scenarios. To see a practical implementation of partial classes, simply create a new Windows Forms project. Then click the Show All Files button in Solution Explorer, expand the Form1.vb item, and double-click the Form1.designer.vb file. Inside this file you can find the definition of the Form1 class, as shown in Listing 7.2 ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.