Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Timer Control
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00605225
Message ID:
00605231
Views:
14
>Can the timer be used as a counter? I would like to know if I could set it on to count in seconds and then turn it off and calculate the time between start and stop and record that to a database
You do not need to use a Timer.

Add two properties to your form, this can be done from the Form menu item on the VFP menu, or programmatically in the Form's INIT() event using something like:
This.AddProperty( "tStart", DateTime() )
This.AddProperty( "iElapsed", 0 )
Then in a command button CLICK() event, add:
If This.Caption == "Start" Then
   This.Caption = "Stop"
   ThisForm.tStart = DateTime()
Else
   This.Caption = "Start"
   ThisForm.iElapsed = DateTime() - ThisForm.tStart
   MessageBox( "Interval = " ;
		+ Transform( ThisForm.iElapsed, "9,999.99" ) ;
		+ " seconds." )
Endif
Return .T.
censored.
Previous
Reply
Map
View

Click here to load this message in the networking platform