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)

{

      MyEvent(((
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 07, 2008 4:15 PM by funky_rus
Filed under: , , ,

Comments

# re: your own custom event delegate

Thursday, August 07, 2008 2:07 PM by Eralp

hi everybody ,

I just wanted to add something to your code.. ,

you may check this event related a method or not like this ,

if (this.myEvent!=null)

{

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

}

just in case ;)

# re: your own custom event delegate

Thursday, August 07, 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

Wednesday, March 16, 2011 6:20 AM by Whitny Swingfield

It was certainly interesting for me to read the article. Thanx for it. I like such topics and everything connected to this matter. I would like to read more soon.        

Whitny  Swingfield      

<a href="rome-escort.info/">escorts girls roma</a>

# re: your own custom event delegate

Saturday, April 02, 2011 2:40 AM by Jenny Flouee

It was extremely interesting for me to read that blog. Thanx for it. I like such topics and everything connected to them. I definitely want to read a bit more on this blog soon.          

Jenny  Flouee          

<a href="milanescorts.com/">milano escort annuncio</a>

# re: your own custom event delegate

Tuesday, April 26, 2011 2:17 PM by Katty Watcerson

It is extremely interesting for me to read this article. Thanks for it. I like such topics and everything that is connected to this matter. I definitely want to read a bit more soon.            

Katty  Watcerson            

<a href="monacoescort.com/">independent ladies escort in monaco</a>

# re: your own custom event delegate

Sunday, August 26, 2012 12:09 AM by www.collectionallgoods.org

Hey there! Someone in my Facebook group shared this site with us so I came to check it out. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Fantastic blog and outstanding design.

# 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!

Leave a Comment

(required) 
(required) 
(optional)
(required)