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

Place a digital clock on a form 1

Status
Not open for further replies.

Mrall

Programmer
Nov 22, 2008
64
US
First of all, is there a way to place a digital clock with the current time on a form? Does it require some type of activex control? If so, is there one out there that is free?

Don't know it it makes any differance but I use VFP6.0

Thanks
 
No, you don't need an ActiveX control. You can do it easily, in any version of VFP.

Just place a label on the format. Format it to make a look like a clockface (for example, big yellow characters on a black background).

Add a timer to the form. Set its interval to, say, 10 seconds. In the Timer event, set the caption of the label to the value returned by LEFT(TIME(),5).

That will give you the time to the nearest minue If you want it to update every second, set the caption to TIME(), and set the timer's interval to, say, 100 ms.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
And what about old-fashioned
Code:
SET CLOCK ON
Hi Tom
 

Old-fashioned SET CLOCK ON is good (even though tiny by default) - but it wouldn't place the clock on a form. It would place onto an upper right corner of the main VFP window, or onto a specified position of the main VFP window if you use SET CLOCK TO nRow, nCol. Which may actually be on a form - if you happen to have an unmovable, fixed size form.
 
The timer worked great. Thanks much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top