theberzerker69
01-26-2004, 07:28 AM
How do you display the date and/or time in a label?
Thanks,
Tom
Thanks,
Tom
Date/Timetheberzerker69 01-26-2004, 07:28 AM How do you display the date and/or time in a label? Thanks, Tom Machaira 01-26-2004, 07:37 AM Label1.Text = Now.Today if you just want the date and not the time. Use just "Now" for both date and time. theberzerker69 01-26-2004, 10:03 AM It worked like you said! But now I need it to display "real time" so that its constantly changing. Your method only shows the date when the form load. Although I put the code into the form.load procedure...holla back reboot 01-26-2004, 11:02 AM Use a timer theberzerker69 01-26-2004, 11:28 AM how would I use a timer(semi-NooB)? Iceplug 01-26-2004, 11:56 AM Go to your form designer window, go to toolbox on the left, click on the timer in the toolbox, then click on the form and a timer is added. Double-click the timer to get access to the timer's Tick event. You can change the interval of the timer in the properties window, and make sure you enable it when you need to use it. :) reboot 01-26-2004, 12:10 PM Or if you'd rather use code (I would) Private _myTimer As System.Threading.Timer 'local to class 'call this to start the timer, pass it the interval Private Sub StartTimer(ByVal period As Integer) Dim callback As New Threading.TimerCallback(AddressOf OnTimer) _myTimer = New System.Threading.Timer(callback, Nothing, 0, period) End Sub 'timer callback Private Sub OnTimer(ByVal State As Object) 'do timer stuff here End Sub 'call this when finished with the timer Private Sub EndTimer() _myTimer.Dispose() _myTimer = Nothing End Sub |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum