Avatar of LeighWardle
LeighWardle
Flag for Australia asked on

VB.NET WinForms code - How to get code to wait until Timer is stopped?

Hi Experts,


I am trying to get a Timer to work in my vb.net code.

Here's my current code:


Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Interval = 1000 '1 second         Timer1.Enabled = True         Timer1.Start()         MsgBox("Why can't this statement get executed after the Timer1 is stopped?")     End Sub     Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick         MsgBox("hello from Timer1")     End Sub End Class

Open in new window

How can I prevent the msgbox statement (and any statements that follow it) from being executed until the Timer is Stopped?


Regards,

Leigh


Visual Basic.NET.NET Programming

Avatar of undefined
Last Comment
LeighWardle

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
AndyAinscow

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Partha Mandayam

What exactly do you want to do with the timer?
LeighWardle

ASKER
Thanks, Andy.

Regards,
Leigh
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23