等几秒钟 [英] wait a few seconds
问题描述
您好,
我希望程序在执行代码之间等待几秒钟。它的价格应该是这样的:
公共子xx()
...代码......
等待(2)''等待2秒
...代码......
结束子
公共子等待(byval secs as整数)
...... ??? ...
end sub
有谁知道如何编程这个''等候''?我已经找了
定时器控件,但是我找不到合适的方法。
谢谢,
Snuyt
Hello,
I want the program to wait a few seconds between executing code. It
should look something like this:
public sub xx()
...code...
wait(2) ''wait 2 seconds
...code...
end sub
public sub wait(byval secs as integer)
...???...
end sub
Does anyone know how to program this ''waiting''? I''ve looked for the
timer control, but I don''t find the right methods for this.
Thanks,
Snuyt
推荐答案
Hallo Snuyt
threading.thread.sleep(2000 )
Cor
Hallo Snuyt
threading.thread.sleep(2000)
Cor
我希望程序在执行代码之间等待几秒钟。它看起来应该是这样的:
public sub xx()
...代码......
等待(2)''等待2秒
...代码......
结束分
公共子等待(byval secs as integer)
...... ??? ...
结束sub
有谁知道如何编程这种等待?我已经找了
定时器控件,但是我找不到合适的方法。
谢谢,
Snuyt
I want the program to wait a few seconds between executing code. It
should look something like this:
public sub xx()
...code...
wait(2) ''wait 2 seconds
...code...
end sub
public sub wait(byval secs as integer)
...???...
end sub
Does anyone know how to program this ''waiting''? I''ve looked for the
timer control, but I don''t find the right methods for this.
Thanks,
Snuyt
我相信如果我们得到更多信息会有所帮助。
等待的目的是什么?重要的原因可能是(而且我不知道任何事情)等待是不是要做的事情。你想把你的应用程序绑在一起,以便它在2秒内无法做任何事情吗?你可以把它放到一个紧凑的循环中观看时钟,但是当它在循环中旋转时,没有任何东西(可能)会发生这种情况。
您是在等待文件打印还是计算完成?每次尝试登录之间有延迟
?你会倾向于以不同的方式等待这些东西。
Tom
" Snuyt" < SN ********** @ skynet.be>在消息中写道
news:40 ********************* @ news.skynet.be ...
I believe it would help if we got just a bit more information.
What is the purpose of the "wait"? The reason it matters is perhaps (and I
don''t mean anything by it) waiting isn''t the thing to do. You want to tie
up your application so that it is unable to do anything for 2 seconds? You
can put it into a tight loop and watch the clock but nothing (probably) is
going to happen while it spins around the loop.
Are you waiting for a file to print or a computation to finish? A delay
between each attempt to login? You would tend to wait a different way on
these things.
Tom
"Snuyt" <sn**********@skynet.be> wrote in message
news:40*********************@news.skynet.be...
您好,
我希望程序在执行代码之间等待几秒钟。它看起来应该是这样的:
public sub xx()
...代码......
等待(2)''等待2秒
...代码......
结束分
公共子等待(byval secs as integer)
...... ??? ...
结束sub
有谁知道如何编程这种等待?我已经找了
定时器控件,但是我找不到合适的方法。
谢谢,
Snuyt
Hello,
I want the program to wait a few seconds between executing code. It
should look something like this:
public sub xx()
...code...
wait(2) ''wait 2 seconds
...code...
end sub
public sub wait(byval secs as integer)
...???...
end sub
Does anyone know how to program this ''waiting''? I''ve looked for the
timer control, but I don''t find the right methods for this.
Thanks,
Snuyt
* Snuyt< sn ********** @ skynet.be> scripsit:
* Snuyt <sn**********@skynet.be> scripsit:
我希望程序在执行代码之间等待几秒钟。它看起来应该是这样的:
I want the program to wait a few seconds between executing code. It
should look something like this:
\\\
....
System.Threading.Thread.Sleep(2000)
....
///
-
Herfried K. Wagner [MVP]
< http://www.mvps.org/dotnet>
\\\
....
System.Threading.Thread.Sleep(2000)
....
///
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
这篇关于等几秒钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!