Home All Groups Group Topic Archive Search About

C# to VB Conversion Help - Overriding Events?

Author
26 Sep 2006 3:43 PM
Spam Catcher
Hi all,

Is this possible in VB.NET?


/// <summary>
        /// We manually implement delegate management, so instead of
        /// declaring event variable we declare accessor methods
        /// </summary>
        public override event BroadcastedMessageHandler
NewBroadcastedMessage
        {
            add
            {
                PersistentEventsHelper.AddEventSink
(value,c_NewBroadcastedMessageEvent);
            }

            remove
            {
                PersistentEventsHelper.RemoveEventSink
(value,c_NewBroadcastedMessageEvent);
            }
        }

Author
26 Sep 2006 3:56 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Spam Catcher" <spamhoneypot@rogers.com> schrieb:
> Is this possible in VB.NET?
>
> /// <summary>
> /// We manually implement delegate management, so instead of
> /// declaring event variable we declare accessor methods
> /// </summary>
> public override event BroadcastedMessageHandler
> NewBroadcastedMessage
> {
> add
> {
> PersistentEventsHelper.AddEventSink
> (value,c_NewBroadcastedMessageEvent);
> }
>
> remove
> {
> PersistentEventsHelper.RemoveEventSink
> (value,c_NewBroadcastedMessageEvent);
> }
> }

Yes, it's possible in VB 2005 (not in previous version!).  Check out 'Custom
Event'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
26 Sep 2006 4:30 PM
Spam Catcher
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in
news:#ON8cRY4GHA.4820@TK2MSFTNGP06.phx.gbl:

> Yes, it's possible in VB 2005 (not in previous version!).  Check out
> 'Custom Event'.

That's what I thought - couldn't find anything for .NET 1.1.

In the end, rewrote the call as 2 sub (add/remove)... works just as well.