Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timer Control
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00605225
Message ID:
00605231
Vues:
12
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform