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
David Anton - 31 Oct 2007 14:47 GMT
(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.

Signature
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,
>
[quoted text clipped - 12 lines]
> thanks,
> rodchar
cfps.Christian - 31 Oct 2007 14:48 GMT
> hey all,
>
[quoted text clipped - 12 lines]
> 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
Lloyd Sheen - 31 Oct 2007 14:59 GMT
> hey all,
>
[quoted text clipped - 12 lines]
> thanks,
> rodchar
Try out this site. It works great for going back and forth between C# and
VB.NET
http://codeconverter.sharpdevelop.net/SnippetConverter.aspx
rodchar - 31 Oct 2007 17:25 GMT
thanks everyone for the insight and resource. i appreciate it very much.
rod.
> hey all,
>
[quoted text clipped - 12 lines]
> thanks,
> rodchar