Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TIMERS EN PARALELO
- http://stackoverflow.com/questions/7923217/two-timers-running-simultaneously-and-independently
- ESTE FUNCIONA
- 'Define your timer objects in your form:
- PrivateShared timer1 As System.Timers.Timer
- PrivateShared timer2 As System.Timers.Timer
- 'Define Two Handlers for the Elapsed Events:
- PublicSub Timer1_Tick(ByVal sender As System.Object,ByVal e As System.EventArgs)'code for timer1 hereendsub
- PublicSub Timer2_Tick(ByVal sender As System.Object,ByVal e As System.EventArgs)'code for timer2 hereendsub
- 'Then in your button click you can add the handlers and start the timers:
- Public Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click
- 'Add handlers programatically
- AddHandler timer1.Elapsed,AddressOf Timer1_Tick
- AddHandler timer2.Elapsed,AddressOf Timer2_Tick
- 'Set up the timer intervals and start them
- timer1.Interval =1000
- timer1.enabled =true
- timer2.Interval =5000
- timer2.Enabled =True
- End sub
Advertisement
Add Comment
Please, Sign In to add comment