Chapter 15. Advanced Windows Forms
WHAT YOU WILL LEARN IN THIS CHAPTER
How to inherit from existing Windows Forms controls and extend them for your own purposes
How to create UserControls that combine controls into a reusable surface
How to create Windows Forms controls that draw their own interface
The previous chapter discussed the basics of Windows Forms 2.0. These capabilities are sufficient for straightforward user interfaces for systems written in VB 2010; but as applications become larger and more complex, it becomes more important to use the advanced capabilities of the .NET environment to better structure the application. Poorly structured large systems tend to have redundant code. Repeated code patterns end up being used (in slightly different variations) in numerous places in an application, which has numerous bad side effects: longer development time, less reliability, more difficult debugging and testing, and tougher maintenance.
Examples of needs that often result in repeated code include ensuring that fields are entered by the user, that the fields are formatted correctly, and that null fields in the database are handled correctly. Proper object-oriented design can encapsulate such functionality, making it unnecessary to use repeated code. Using the full object-oriented capabilities of the .NET environment, plus additional capabilities specific to Windows Forms programming, you can componentize your logic, enabling the same code to be used in numerous places in your application. ...