troubleshooting Question

Exit an application from a do...loop

Avatar of DColin
DColinFlag for Thailand asked on
Visual Basic.NET
6 Comments2 Solutions170 ViewsLast Modified:
Hi Experts,

The attached code will execute a do...loop for 30 seconds and exit. If the form's close (red x) is clicked the application does not exit the loop. How should this code be rewritten to correctly handle the close request.
Imports System.Threading

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    End Sub

    Private Sub MySub()

        Dim OverTime As DateTime = Now.AddSeconds(30)

        Do Until Now > OverTime



    End Sub

End Class
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros