In VB6 we have the below code.
g_CTimer.TimerID = SetTimer(0&, 0&, g_CTimer.Interval, AddressOf TimerProc)
The TimerProc method is as below
Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long)
On Error Resume Next
If g_CTimer Is Nothing Then Exit Sub
g_CTimer.ThatTime
End Sub
How do we convert that call "AddressOf TimerProc" in C#.
Thanks in Advance.
Regards Achyuth
In C# you can just omit the
AddressOf
keyword. In VB.NET it explicitly implies that you are sending the method pointer as an argument (a pointer toTimerProc
, in this case). In C# you can just use the method name directly.That said, you're probably better off just re-implementing this with a normal timer (
Windows.Forms.Timer
or some other).