Wrox Programmer Forums
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 3rd, 2004, 09:39 PM
Registered User
Join Date: May 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to mjwelker
Default Display Continuous Time

I've been trying for a couple hours now, and I can not figure out how to display the time with the seconds ticking away, any help would greatly be appreciated!

Old May 4th, 2004, 08:31 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts

Here is an example, modify it to get it to work the way you want it.

Add a Label control and a Timer control to your form. Name the label "lblTime" and name the timer "tmr". Set the timer's Interval property to 1000. This is the number of milliseconds that will pass before the tick event is fired (1000 ms = 1 second). Also set the timer's Enabled property to True.

Double-click the timer control to bring up it's Tick event. Your tick event should look something like this:

Private Sub tmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmr.Tick
        Dim dt As DateTime = DateTime.Now
        lblTime.Text = dt.ToLongTimeString
End Sub

See if this helps you out.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Continuous Time (Clock) mjwelker VB How-To 4 April 8th, 2009 05:15 PM
Display current time 'fast' on a form. jpool Visual Basic 2005 Basics 1 July 4th, 2008 01:39 PM
How to display the time(running time) in Excel swaroop Excel VBA 1 March 29th, 2007 01:56 AM
display server time arabuafef Classic ASP Basics 1 March 18th, 2007 06:16 PM
Display time on the report rajanikrishna Crystal Reports 0 March 11th, 2005 06:17 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.