Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Contents of Timer Control in Label

Status
Not open for further replies.

jeak

Technical User
Oct 9, 2002
16
0
0
US
Hi!

I am trying to show the contents of the timer control in a label. For example, I would like to set the timer interval at 15 seconds and have it count down to zero. How would I show this in the label? Please let me know if you have any suggestions.

Thanks!
 
Create a static variable in the Timer Event. Inside the timer event, only execute the appropriate code when the timer value gets down to 0. This is a shell which should give you the general idea
Code:
Private Sub tmrTest_Timer()

   Static fInt_Secs As Integer
   
   Select Case fInt_Secs
      Case 0
         fInt_Secs = 15
      Case 1
         ExecuteTheCode
         fInt_Secs = 15   
      Case Else
         fInt_Secs = fInt_Secs - 1
   End Select

   lblRemaining.Caption = Str(fInt_Secs)
   lblRemaining.Refresh

End Sub
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top