I created a user control with an event. I do not want to add the following code every time I add a new instance of the control to a form.
Control1.Operate += new MyControl.OperateEventHandler(Control1_Operate)
Instead I would like to simply double-click the control and have the above code added by the IDE to the Designer file. By default the Control1_Load event is assigned in the Designer file. Is it possible to change this?
It seems you want to set a
DefaultEventfor your control.Use
DefaultEventAttributeon your Control class.A similar question exists:
How can I set the default event to be edited for my custom control in Visual Studio?
Hope it helps!