Imports System
Imports System.Threading
Public Module modmain
   Sub Main()
      'The KPD-Team 2001
      'URL: http://www.allapi.net/dotnet/
      'E-Mail: KPDTeam@Allapi.net
      'Create a new "timer event" class
      Dim MyTimer as Second = new Second()
      'Create a new timer
      Dim tmr as Timer = new Timer(new TimerCallback( _
         AddressOf MyTimer.TimerEvent), Nothing, 100, 100)
      'Create a new ManualResetEvent object
      Dim ev as ManualResetEvent = new ManualResetEvent(False)
      'Wait for 2 seconds
      ev.WaitOne(2000, False)
      Console.WriteLine("Waited 2 seconds...")
   End Sub
End Module
Public Class Second
   Public Sub TimerEvent(o as Object)
      Console.WriteLine("Timer event...")
   End Sub
End Class

Close this window