How can I return the method that is called when an event is raised ?
System.Reflection.EventInfo.GetRaiseMethod does not work.
System.Reflection.EventInfo.GetRaiseMethod does not work.
This in turn has an items property you can then get the method you want, I don't have any code samples since I'v never had to do this, but it does look feasible.
QUESTION ?
HOW CAN I RAISE ANY EVENT OF A CONTROL OR COMPONENT ?
I'm not sure if i understand it correctly but can't you just cal then on..... sub like onclick(e as clickeventargs) and onLoad(e as eventargs)
Remco
http://msdn2.microsoft.com/en-US/library/system.componentmodel.design.ieventbindingservice(VS.80).aspx
Use TypeDescriptor.GetEvents to get the event descriptors for the object. The IEventBindingService.GetEventProperty method returns a property descriptor for a string property, the value of which is the name of the method that will be called when the event is fired.
Obviously if you want to get the method at run-time you won't have an event binding service so as far as I know there is no standard way of doing that.
Edit:
Just realised from the context that what you want isn't "the method that is called when an event is raised" but the method that raises the event. As far as I know there is no standard way of getting this (which is generally a good thing IMO) but certain classes provide methods for raising specific events e.g. System.Windows.Form.Control.InvokeOnClick