lost in translation

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
(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
 
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
 
Back
Top