Ambivalentiowa,
i think i can't use a loop because i need to be able to perform something else (like click a button...) while my timer perform another task. i am not allowed to use a timer control..is there another way?.
Printable View
Ambivalentiowa,
i think i can't use a loop because i need to be able to perform something else (like click a button...) while my timer perform another task. i am not allowed to use a timer control..is there another way?.
You could try an API timer.
In a module
VB Code:
Option Explicit Public Declare Function SetTimer Lib "user32" _ (ByVal hwnd As Long, ByVal nIDEvent As Long, _ ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long Public Declare Function KillTimer Lib "user32" _ (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) MsgBox "place your timer code here" End Sub
In your form
Since the interval property is a long, you can run your timer for about 50 days.VB Code:
Option Explicit Private Sub Command1_Click() ' create the timer ' The third parameter is the intervals in milliseconds SetTimer Me.hwnd, 1, 10000, AddressOf TimerProc End Sub Private Sub Form_Unload(Cancel As Integer) ' Stop the timer KillTimer Me.hwnd, 1 End Sub