Properties, Methods, and Events for Custom Controls
A custom control is any control that is created by the user, be it derived from the UserControl class, the Control class, or an existing Windows Forms control. Your control provides front-end functionality through its graphical interface, but provides back-end functionality through its methods, properties, and events. Methods are the actions a user can tell your control to execute. Properties and member variables are data a user of your control can get or set. Events are notifications that something interesting has happened to your component.
Adding properties and methods is easy — a method is any public procedure you declare in your control class; a property can be declared using a Property statement in Visual Basic, or implemented as a public member variable in C#.
The following topics examine the issues you should be aware of when declaring properties and methods in a control.
In This Section
- Exposing Properties of Constituent Controls
- Describes how to expose the properties of a constituent control to developers using your user control.
- Method Implementation in Custom Controls
- Provides conceptual information on implementing methods in your control and overloading methods.
- Event Implementation for Components and Custom Controls with Visual Basic
- Provides conceptual information for Visual Basic developers on events in your user control.
- Developing ASP.NET Server Controls
- Provides links to topics about how to create methods and properties for custom server controls that work with Web Forms.