Stoitcho
Tue Feb 10 15:03:28 CST 2004
Hi Herfried,
I don't think Alec asks for that solution. Alec wants to count the event
handler of Control's Click event.
--
B\rgds
100
--
B\rgds
100
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uFr1hWB8DHA.1504@TK2MSFTNGP12.phx.gbl...
> * "=?Utf-8?B?QWxlYyBEb2JiaWU=?="
<Alec.Dobbie@gingerMonkey.SmartApproach.com> scripsit:
> > I have a customer control that inherits from
> > System.Windows.Forms.Control. Its not the worlds most complicated
> > control but I have a problem. I'm trying to get a count of the number
> > of events connected to base.click.
>
> \\\
> Public Class Main
> Public Shared Sub Main()
> Dim c As New FooBar()
> AddHandler c.Foo, AddressOf Goo
> c.AddSampleHandler()
> c.AddSampleHandler()
> Console.WriteLine( _
> "Anzahl der Handler für Foo: {0}", _
> c.NumberOfFooHandlers _
> )
> RemoveHandler c.Foo, AddressOf Goo
> Console.Read()
> End Sub
>
> Private Shared Sub Goo()
> End Sub
> End Class
>
> Public Class FooBar
> Public Event Foo()
>
> Public ReadOnly Property NumberOfFooHandlers() As Integer
> Get
> Return FooEvent.GetInvocationList().Length
> End Get
> End Property
>
> Public Sub AddSampleHandler()
> AddHandler Foo, AddressOf Moo
> End Sub
>
> Private Sub Moo()
> End Sub
> End Class
> ///
>
> --
> Herfried K. Wagner [MVP]
> <
http://www.mvps.org/dotnet>