Re: Continuous Beep program
Re: Continuous Beep program
Beep in synchronous, so if its set to run for a second you can't just stop it until that duration is done, hence there will be a delay after you hit the stop button depending on how much duration of the beep is left.
add a public variable as a stop flag to the module,
Public StopBeep As Boolean
In your form you could maybe do this,
Code:
Private Sub Command1_Click()
' start beep
StopBeep = False
Do
DoEvents
If StopBeep = True Then Exit Do
Beep 1000, 1000
Loop
End Sub
Private Sub Command2_Click()
' stop beep
StopBeep = True
End Sub