问题描述
我有一个sub需要做一些事情然后等待指定长度的
时间再继续。我尝试在其tick事件中添加一个带计数器的计时器
然后检查子程序中的计数器状态。但这并不是
工作:
单身进度模糊
Sub mysub
stuff
timer1.enabled = true
进度时< 1
textbox1.text = progress
结束更多的东西
end sub
timer1 tick事件处理程序
进度=进度+.01
结束
文本框显示我没有发生任何事情。程序挂断了。
这样做的正确方法是什么?这应该是一个线程应用吗?
-
mark
I have a sub which needs to do some things then wait a specified length of
time before going on. I tried adding a timer with counter in its tick event
then checking the state of the counter in the subprocedure. But this doesn''t
work:
dim progress as single
Sub mysub
stuff
timer1.enabled = true
while progress <1
textbox1.text=progress
end while
more stuff
end sub
timer1 tick event handler
progress = progress +.01
end
The textbox shows me that nothing is happening. The program hangs up.
What''s the right way to do this? Should this be a threading application?
--
mark
推荐答案
这篇关于具有计时器要求的子程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!