How can i put a timer between events .. I mean . If the program is dont processing a line then i want it to wait for 3 seconds and then start processing again .
Printable View
How can i put a timer between events .. I mean . If the program is dont processing a line then i want it to wait for 3 seconds and then start processing again .
That sounds like multithreading. Can you be more clear? Do you mean you just want your program to do nothing for 3 seconds, or allow other parts of your program to execute for 3 seconds while the other part waits?
Use the sleep Api
Use it like this:Code:Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Sleep(3000) 'for 3 seconds
well the other parts are alredy executing ..
Well may be there is an easier way to do it ... But cause i am new to VB so i dont know all the shorcuts ... I want a lable to flash ..
I am using it kind of like a process indicator ....
so i want to use a timer so that it flashes every second or something..
I hope you understand what i am saying
Set the timer.enabeled = false when you start processing and when it's done processing to timer.enabeled = true this will do the trick i think
Grtz,
Bloged
hy,
try this ... probably ...
code:
----------------
'Your timer interval must be 3000
Private Sub Timer1_Timer ()
'Your command ...
Timer1.Interval = 0
Timer2.Interval = 3000
End Sub
Private Sub Timer2_Timer ()
'Your command ...
Timer1.Interval = 3000
Timer2.Interval = 0
End Sub
------------------
and so it works:
timer1 is running 3 sek until your command is executed
after your command is exec the timerinterval is set to 0
then this timer (timer1) is "shut down"
--> now timer2's interval is set to 3 sek ... after 3 sek (tim2) the same procedure starts again
Longbow
hope you understand ...
:confused: :confused: :confused:
But if you want the label to flash at a constant rate, you can't necessarily rely on a timer. You may want to try multithreading. ...But if you are newish to VB or the concept of threads, just use the timer. :)
Well i am not really that new to VB .. and i do have the concept about multi threads .. but unfortunately i never really got to use it ... But i think that it should be soemthing interesting to learn ...
Interesting doesn't begin to describe it. ;)