I expect the next program wait 1 sec. and exit but doesn't work.
Could anybody help me?

Private Sub Command1_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
aaa = 0
If aaa < 1 Then
GoTo lo
End If
End Sub

Private Sub Timer1_Timer()
aaa = 10
End Sub

thx. Sandor

Recommended Answers

All 5 Replies

that is because your loop is not executing at all. Try to run the code in the timer_timer event

What is the Main Objective of the Code?

What is the Main Objective of the Code?

that is all. I want to controll an equipment via com port and I need to wait some millisec.
Wait rutin I would use more times, more places in main program.
The program only wait some millisec., after that continue.
thanks for your help

Use Sleep() API it will freeze ur Application for given milliseconds

Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

1000 Milliseconnds = 1 Second

Any time you use a timer, put a DoEvents in the loop. The timer object is basically unreliable. There are better substitutes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.