Vb:如何暂停循环一段时间然后继续? [英] Vb: how to pause a loop for a certain amount of time and then continue?
本文介绍了Vb:如何暂停循环一段时间然后继续?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
推荐答案
我不确定浏览器是否在单独的线程上呈现.如果是,那么以下应该有效:
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
如果浏览器控件在与您的应用程序相同的线程上呈现,那么您将必须重构代码以使用 Thomas L 建议的计时器.
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:如何暂停循环一段时间然后继续?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文