Vb: how to pause a loop for a certain amount of ti

2020-04-29 23:25发布

问题:

    Dim d As Integer
    For d = 0 To TextBox2.Text

        WebBrowser1.Navigate(TextBox1.Text)

       //a code that pauses the loop but does not stop the browser thread

    Next d

回答1:

I'm not sure if the browser is rendering on a separate thread. If it is then the following should work:

System.Threading.Thread.Sleep(3000) ' Sleep for 3 seconds

If the browser control is rendering on the same thread as your application then you will have to refactor the code to utilize a timer as Thomas L suggested.



标签: vb.net