vb:如何等待一秒钟? [英] vb: how to wait for a second?
问题描述
我有一个代码,我对文件执行了几个操作。
在这些操作之间,我想等待1秒钟。或2秒。
如何在不使用计时器的情况下轻松完成此操作? Jurgen
I have a code where I perform several actions on files.
Between these actions I want to wait for 1 second. Or 2 seconds.
How can I easily do this without using a timer? Jurgen
推荐答案
Jurgen Oerlemans< ju ************** @ envirolab.no_spam.nl>写道:
Jurgen Oerlemans <ju**************@envirolab.no_spam.nl> wrote:
我有一个代码,我在文件上执行几个操作。
在这些操作之间,我想等待1秒钟。或2秒。
如何在不使用计时器的情况下轻松完成此操作? Jurgen
I have a code where I perform several actions on files.
Between these actions I want to wait for 1 second. Or 2 seconds.
How can I easily do this without using a timer? Jurgen
好吧,Thread.Sleep会使当前线程暂停一秒钟。你在
不想在UI线程上这样做...
出于兴趣,你为什么要避免使用计时器?
-
Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet
如果回复该群组,请不要给我发邮件
Well, Thread.Sleep will make the current thread pause for a second. You
don''t want to do that on a UI thread though...
Out of interest, why do you want to avoid using a timer?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
好吧,坦率地说,我不知道如何使用计时器来简单地等待
等待-statement。
我用一个来每5分钟执行一次动作,但不知道如何使用
一个暂停程序一秒然后继续....
另外,使用thread.sleep也会给我带来各种错误,例如
名称''Thread''未声明。
Jurgen
" Jon Skeet [C#MVP]" < SK *** @ pobox.com>在消息中写道
新闻:MP ************************ @ msnews.microsoft.c om ...
well, to be quite frankly I don''t know how to use a timer for a simple
wait-statement.
I use one to perform an action every 5 minutes, but don''t know how to use
one to pause the program for a second and then proceed....
Also, using thread.sleep gives me also all kinds of errors like
Name ''Thread'' is not declared.
Jurgen
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Jurgen Oerlemans< ju ************** @ envirolab.no_spam.nl>写道:
Jurgen Oerlemans <ju**************@envirolab.no_spam.nl> wrote:
我有一个代码,我在文件上执行几个操作。
在这些操作之间,我想等待1秒钟。或2秒。
如何在不使用计时器的情况下轻松完成此操作? Jurgen
I have a code where I perform several actions on files.
Between these actions I want to wait for 1 second. Or 2 seconds.
How can I easily do this without using a timer? Jurgen
好吧,Thread.Sleep会使当前线程暂停一秒钟。你不想在UI线程上这样做...
出于兴趣,你为什么要避免使用计时器?
> -
Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet
如果回复该群组,请不要给我发邮件
Well, Thread.Sleep will make the current thread pause for a second. You
don''t want to do that on a UI thread though...
Out of interest, why do you want to avoid using a timer?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
嗨Jurgen,
Threading.thread.sleep(1000)
让主线程休眠1秒钟。 />
Cor
Hi Jurgen,
Threading.thread.sleep(1000)
Let the main thread sleep 1 second.
Cor
这篇关于vb:如何等待一秒钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!