I have to convert an C# code to VB.NET, but I’ve some problem….can you help me?
This is the C# source:
public static event ValueEnterEventHandler CallEvent;
public static void DispatchCompanyCall(string moduleName)
{
if (IsReady && CallEvent != null)
CallEvent(null, new ValueEnterEventArgs(moduleName, false));
}
I have tryed this:
Public Shared Event CallEvent As ValueEnterEventHandler
Public Shared Sub DispatchCompanyCall(moduleName As String)
If IsReady AndAlso CallEvent IsNot Nothing Then
CallEvent(Nothing, New ValueEnterEventArgs(moduleName, False))
End If
End Sub
but I’ve this error message: CallEvent is an event and cannot called directly, use RaiseEvent statement to raise an event
What should I write? Can you help me? Thanks.
With VB.Net there is no need to check events for
null/Nothingand you can just raise them directly via theRaiseEventkeyword