468,268 Members | 1,656 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,268 developers. It's quick & easy.

EventInfo.GetRaiseMethod() always returns null

I am trying to use this method to get a MethodInfo object
but the method always returns a null.
See my sample code below:

this.button1 = new System.Windows.Forms.Button();
this.button1.Click += new System.EventHandler
(this.button1_Click);

private void button1_Click(object sender, System.EventArgs
e)
{
EventInfo eventInfo = (sender as Button).GetType().GetEvent
("Click");

// This line always results in raiseMethod being null
MethodInfo raiseMethod = eventInfo.GetRaiseMethod();

}

Thanks for any help.
Nov 22 '05 #1
1 3854
Sergio,
I am trying to use this method to get a MethodInfo object
but the method always returns a null.


I don't know which method's MethodInfo you want to retrieve, but
events generated by the C# compiler (or VB.NET) never have a raise
method associated with them (it's optional) so that's why
GetRaiseMethod always will return null for those events.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Stefan Weiss | last post: by
2 posts views Thread by Rene van Hoek | last post: by
1 post views Thread by Sergio Geralnik | last post: by
reply views Thread by Zoury | last post: by
6 posts views Thread by Java script Dude | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.