Home All Groups Group Topic Archive Search About

Convert Event from C# to VB.Net

Author
13 Feb 2006 5:26 AM
Husam
Hi EveryBody:

I have the following event written by C# And I want some body help me or
advise me in how can I write it in Vb.Net, also if there is any refreance
that I have to add please tell me :

public event EventHandler ReadyStateComplete {
            add {
                Events.AddHandler(_readyStateCompleteEvent, value);
            }
            remove {
                Events.RemoveHandler(_readyStateCompleteEvent, value);
            }
        }
any help will be completlly appreciated

regard's

Husam

Author
13 Feb 2006 11:08 AM
Carlos J. Quintero [VB MVP]
Hi Husam,

VB.NET 2002/2003 does not support custom events but VB.NET 2005 does, so
check the help docs about "Custom Event":

   Public Custom Event ReadyStateComplete As EventHandler

      AddHandler(ByVal value As EventHandler)
            ...
      End AddHandler

      RemoveHandler(ByVal value As EventHandler)
            ...
      End RemoveHandler

      RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
            ...
      End RaiseEvent

   End Event

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com



Show quoteHide quote
"Husam" <Hu***@discussions.microsoft.com> escribió en el mensaje
news:6429B9E2-2705-4A36-8080-5A1254567600@microsoft.com...
> Hi EveryBody:
>
> I have the following event written by C# And I want some body help me or
> advise me in how can I write it in Vb.Net, also if there is any refreance
> that I have to add please tell me :
>
> public event EventHandler ReadyStateComplete {
>            add {
>                Events.AddHandler(_readyStateCompleteEvent, value);
>            }
>            remove {
>                Events.RemoveHandler(_readyStateCompleteEvent, value);
>            }
>        }
> any help will be completlly appreciated
>
> regard's
>
> Husam