need help with the below logic/code

Status
Not open for further replies.

arian29

In the zone
:!:

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

'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..
 
OP
A

arian29

In the zone
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.
 

silent008

Broken In
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
 
Status
Not open for further replies.
Top Bottom