DIGIT-ARC read-only archive · snapshot: July 23, 2026

need help with the below logic/code

4 posts · originally from https://geek.digit.in/community/threads/need-help-with-the-below-logic-code.109702/

A
arian29 Original post #1
Feb 28, 2009 at 10:24 PM
:!:

')))))))))))))))))))))

'form2

Private Sub Command1_Click()
Unload Form2

Form3.Show
End Sub


')))))))))))))))))))))

'form3

Private Sub Command1_Click()
Unload Form3


Form4.Show

End Sub

Private Sub Form_Load()

Counter = 5

End Sub


Private Sub Timer1_Timer()

Counter = Counter - 1 'we set the counter to count here

Text3.Text = Counter

'If Text3.Text = 0 Then
'MsgBox ("DONE")
'Unload Me
'End If

End Sub

'----------------

what happens is that "Sub Timer1_Timer()" never execited. the focus goes from the first End Sub in form3 to the End Sub in form2 and thats it, nothing happens. "Private Sub Timer1_Timer()" never executes. need some help here pls..
S
Feb 28, 2009 at 11:12 PM
Have you set the timer interval. If yes to what value
A
arian29 #3
Mar 1, 2009 at 11:25 AM
interval is set to 1000. changed the code to:

'**********************************
'form3

Private Sub Form_Load()

Counter = 5

End Sub


Private Sub Timer1_Timer()

Counter = Counter - 1

Text3.Text = Counter

End Sub

'*************************************

now what happens is the the value of "counter" is always 0 in Timer1_Timer() even though it has been initialized to 5 in Form_Load(). so i am getting -1 as the value in counter when i run the code.
S
Mar 1, 2009 at 6:58 PM
No doubt the counter has been initialized to 5 in form load, but I think that every second the timer event occurs and counter is decremented so it will have a value of -1 at som point of time.

I am jst trying to help, even i might be wrong