Creating Custom Controls

What is the difference between a UserControl and a custom control? Not much. The UserControl jumpstarts creating custom controls because it provides you with a form-like canvas to paint controls on. However, if you want to extend the behavior of an existing control, rather than starting from scratch, you want to implement a custom control.

The most significant difference is that when you define a custom control, you will modify the Inherits statement to inherit from a specific existing control. When you inherit from an existing control, you get all of the behaviors and attributes of that existing control and anything else you add. The section “Creating a Custom Component” in Chapter 12, “Defining Attributes,” demonstrates ...

Get Visual Basic® .NET 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.