How can I use Timer in VB.Net? I want to repeat a statement after every 5 seconds but timer event offers only timer_tick() and timer_disposed()
In which event I can write my required code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could write your event in the
timer_tick().It’s worth noting that your timer tick is in Milliseconds (ms) so you’ll need to set its property to 5000 for 5 seconds.
You’ll also need to start the timer (
timer1.start) (you can do this on form load if you want the action to start from when the form is first loaded) and then put your loop in thetimer_tick()section 🙂Have a look here for a rudimentary explanation: