troubleshooting Question

Timer instead of sleep vb.net

Avatar of ClaudeWalker
ClaudeWalker asked on
Visual Basic.NETVisual Basic Classic
10 Comments3 Solutions949 ViewsLast Modified:
I am trying to have a program wait before execution however Threading.sleep does not allow execution while it's waiting.  

I'm trying to set up a timer to pause execution but I'm unsure how to do it.

Thanks,
JOe K.
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, _
                        ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) _
                        Handles WebBrowser1.DocumentCompleted

        'MsgBox(cnt)
        Dim t As Timer
        t.Start() 'how can I use this to delay the subsequent 
'lines of code.  Lets say I want a 3 second delay to allow
'a page to fully load (including javascript which the event
'is not waiting for).
        Dim MSDNpage As String = WebBrowser1.Document.Body.InnerText
        My.Computer.FileSystem.WriteAllText("C:\Quib\" & cnt & ".txt", MSDNpage, False)
        nextPage()
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 10 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 3 Answers and 10 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