- Jul 11, 2004
- 21,867
- 7
- 81
I've been playing around with a little VB.Net just for fun. I'm trying to get a function to run every x seconds (say a clock that updates the time every second). I keep finding code on the internet similiar to this:
Dim t As New System.Timers.Timer(2000)
AddHandler t.Elapsed, AddressOf TimerFired <---- what does this line do?
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
'Do stuff Here
End Sub
Source
Basically I have been putting the code I want to execute inside of the TimerFired() method. Everything compiles fine, but nothing happens when I run the program. I can't seem to find any useful information on the internet. That or I'm missing something really basic here.
Also, does anyone know of any nice resources on the internet for VB.Net?
Dim t As New System.Timers.Timer(2000)
AddHandler t.Elapsed, AddressOf TimerFired <---- what does this line do?
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
'Do stuff Here
End Sub
Source
Basically I have been putting the code I want to execute inside of the TimerFired() method. Everything compiles fine, but nothing happens when I run the program. I can't seem to find any useful information on the internet. That or I'm missing something really basic here.
Also, does anyone know of any nice resources on the internet for VB.Net?