What is the equivalent of following C# code to VB.net code.
public void RaiseTotalTimeEvent(TotalTimeEventArgs e)
{
EventHandler<TotalTimeEventArgs> temp = TotalTimeEvent;
if (temp != null)
{
temp(this, e);
}
}
EDIT
Thanks for the answer.
But all the answers looks like it was converted using some of the existing CODE converter.
I have tried Telerik,DeveloperFusion, And others. All these tools generate same code like below and none of these work.
Converted Code.
Public Sub RaiseTotalTimeEvent(e As TotalTimeEventArgs)
Dim temp As EventHandler(Of TotalTimeEventArgs) = TotalTimeEvent
RaiseEvent temp(Me, e)
End Sub
Compiler Reports with this error:
Error 8 ‘Public Event CountEvent(sender As Object, e As
CountEventArgs)’ is an event, and cannot be called directly. Use a
‘RaiseEvent’ statement to raise an event.
You should avoid automatically translating code from one language into another. Instead you should learn to understand and rewrite the code to solve the problem in your preferred language.
But there are translators. http://www.developerfusion.com/tools/convert/csharp-to-vb/