1 Replies - 417 Views - Last Post: 12 September 2012 - 11:02 AM Rate Topic: -----

#1 vezznay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-September 12

thread.sleep help (I'm a novice so this may be very easy)

Posted 12 September 2012 - 09:11 AM

Hello Guys,

I'm looking to pause my program from running for a set period of time.

I'd like to retrieve the amount of time the programs sleeps from a Dim named 'waitOne', however it breaks.

Can thread.sleep take it's values from a dim?

I'm sure there is a really simple solution to this (I've never programmed before really)


   Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        If Automate = True Then Automate = False Else Exit Sub
        Dim searchQuery = RichTextBox2.Text
        Dim waitOne = pauseOne.Text
        Dim waitTwo = pauseTwo.Text
        Dim waitThree = pauseThree.Text
        Dim waitFour = pauseFour.Text




        If RadioButton1.Checked Then


            Dim txtGoogle As HtmlElement = WebBrowser1.document.GetElementById("q")
            Dim btnGoogle As HtmlElement = WebBrowser1.document.GetElementById("btnG")

            txtGoogle.SetAttribute("value", searchQuery)
            btnGoogle.InvokeMember("click")

        Else

            Dim txtBing As HtmlElement = WebBrowser1.document.GetElementById("sb_form_q")
            Dim btnBing As HtmlElement = WebBrowser1.document.GetElementById("sb_form_go")

            txtBing.SetAttribute("value", searchQuery)
            btnBing.InvokeMember("click")

        End If

        If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then

            Threading.Thread.Sleep("waitOne")


        End If




Is This A Good Question/Topic? 0
  • +

Replies To: thread.sleep help (I'm a novice so this may be very easy)

#2 Neku  Icon User is offline

  • D.I.C Regular

Reputation: 20
  • View blog
  • Posts: 268
  • Joined: 21-May 09

Re: thread.sleep help (I'm a novice so this may be very easy)

Posted 12 September 2012 - 11:02 AM

sorry thats VB.net code not VB6
in VB6 you use the sleep command and give the time in miliseconds

Sleep(5000) 'pause the program for full 5 seconds (1000 milisec = 1 sec


note that when the program sleep it would simply not respond at all so using very long time can be bad idea
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1