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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Current Time 2

Status
Not open for further replies.

David Higgs

Programmer
May 6, 2012
392
GB
In my application I'd like to constantly update and display the "Current Time" in a Text Box called "Start Time". When data is entered in another Text Box and this Text Box Loses Focus I'd like the "Start Time" to stop updating.

Is this possible?

Regards,

David.

Recreational user of VFP.
 
Add a timer and set the interval to 1000 (one second) then in Timer event put:
Code:
thisform.TextBoxStartTime.Value = TIME()

in GotFocus event of this TextBox put:
Code:
thisform.Timer1.Enabled = .t.

in LostFocus event of this TextBox put:
Code:
thisform.Timer1.Enabled = .f.

Borislav Borissov
VFP9 SP2, SQL Server
 
[pre]SET CLOCK ON[/pre]



If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Borislav Borissov,

Thank you for your help, it was much appreciated. I tried your code on a Test Form and it does everything that I asked for. I can now put the code in my application and expand on it.


Regards,

David.

Recreational user of VFP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top