Jim,
> Is there a way when editing an event in a user control not to call the parent? For example, if I have a user control, say a button, and I place the user control on a webform. I then create some code for the click event of the button and don't want to call the parent. How would I accomplish this? It would be the same as nodefault in VFP.
To override any event in .NET you need to override its associated "On" event.
In .NET, events have an associated "On
" method that is used to raise the event. For example, a button has a Click event and an associated OnClick method. Within the OnClick method, the Click event is raised. You can override the OnClick method and not call the parent (base) class OnClick which effectively overrides the event.
This convention of having an event with an associated "On" method is a standard that you should also use for any custom events you create yourself. This allows consumers of your class to override the event. For example, in my mmBusinessObject class I have a StateChange event that is raised whenever my business object changes state. I have created an associated OnStateChange method that raises the StateChange event.
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com