Thank you After some investigation, I cannot seem to get this to work.
I created this method: private static void DisplayDelegate(Delegate obj) { foreach (Delegate d in obj.GetInvocationList()) { Console.WriteLine("Method Name: {0}", d.Method); Console.WriteLine("Type Name: {0}", d.Target); } } and called the method as such: DisplayDelegate(cb.CheckedChanged) where cb is a System.Web.UI.WebControls.CheckBox and the compiler tells me: The event 'System.Web.UI.WebControls.CheckBox.CheckedChanged' can only appear on the left hand side of += or -= What might I be doing incorrectly here? Is what I want to do even possible? Thanks, Mike On 2/14/07, Phil Sayers <[EMAIL PROTECTED]> wrote:
google for GetInvocationList that should point you in the right direction -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of Mike Andrews Sent: Wednesday, February 14, 2007 2:52 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [ADVANCED-DOTNET] Determining if an event has been assigned a delegate... Guys, Do any of you know if it's possible to determine if an event for an object has been assigned a delegate? Example: Dim cb As New CheckBox() cb.Name = "MyCheckBox" AddHandler(cb.CheckChanged, AddressOf CheckChanged) ... Public Sub CheckChanged(Object sender, EventArgs e) ... End Sub Is it possible to know if cb.CheckChanged has been assigned a handler or not? Thanks, Mike =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com