your own custom event delegate

in MyControl:

public delegate void MyEventHandler(int value, string text);

public event MyEventHandler MyEvent;


protected void ddl_SelectedIndexChanged(object sender, EventArgs e)


DropDownList)sender).SelectedIndex, ((DropDownList)sender).SelectedItem.Text);



in Parent:

this.MyControl.MyEvent += new AAL.FreedomWeb.Web.UI.UserControls.AircraftConfig.MyEventHandler(MyControl_MyEvent);


private void MyControl_MyEvent(int value, string text)


      throw new NotImplementedException();


Published Thursday, August 7, 2008 4:15 PM by funky_rus
Filed under: , , ,


# re: your own custom event delegate

Thursday, August 7, 2008 4:22 PM by Patrik Hägne

All event handlers should be voids with two parameters, the first being the sender of the event (typed as object) and the second being event arguments (typed as EventArgs or inherited class). Always use the typed event handler delegate EventHandler<T>, there's no reason to create a custom delegate for this ever.

# re: your own custom event delegate

Sunday, November 18, 2012 6:04 PM by north face jackets clearance

Hey! This post couldn't be written any better! Reading this post reminds me of my previous room mate! He always kept talking about this. I will forward this page to him. Pretty sure he will have a good read. Many thanks for sharing!