lost in translation

G

Guest

hey all,

could someone please help me translate the following c# snippet:

public event EventHandler BubbleClick;
protected void OnBubbleClick(EventArgs e)
{
if(BubbleClick != null)
{
BubbleClick(this, e);
}
}
i'm particularly having problems with the if statement.

thanks,
rodchar
 
G

Guest

(via Instant VB):
Public Event BubbleClick As EventHandler
Protected Sub OnBubbleClick(ByVal e As EventArgs)
If BubbleClickEvent IsNot Nothing Then
RaiseEvent BubbleClick(Me, e)
End If
End Sub

However, you do not really need the check against the hidden (nearly
undocumented) VB EventNameEvent variable if all you're doing is calling
RaiseEvent. RaiseEvent will gracefully handle cases where there are no
subscribers to the event.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to C++/CLI
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
 
C

cfps.Christian

hey all,

could someone please help me translate the following c# snippet:

public event EventHandler BubbleClick;
protected void OnBubbleClick(EventArgs e)
{
if(BubbleClick != null)
{
BubbleClick(this, e);
}
}
i'm particularly having problems with the if statement.

thanks,
rodchar

C# doesn't call the event handler unless it is assigned.

So I think it should read in VB

protected sub OnBubbleClick(byval e as eventargs)
raiseevent bubbleclick(this, e)
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top