This works for me. The timer fires the
Elapsed
event every twenty seconds.
Dim mytimer As New System.Timers.Timer
Sub MyRefresh()
write2Size()
mytimer = New System.Timers.Timer(20000)
AddHandler mytimer.Elapsed, AddressOf OnTimedEvent
mytimer.Enabled = True
Cursor.Current = Cursors.WaitCursor
objworkbook.Save()
objExcel.ActiveWorkbook.Save()
myDS.Clear()
retrieveUpdate()
Cursor.Current = Cursors.Default
End Sub
Private Shared Sub OnTimedEvent(source As Object, e As ElapsedEventArgs)
Console.WriteLine("The Elapsed event was raised at {0}", e.SignalTime)
End Sub