Hack Forums
[.NET] [VB.NET]Show system time - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET]Show system time (/showthread.php?tid=394160)



[VB.NET]Show system time - codepoet - Apr 30, 2010

Show system time into StatusStrip (lable)

Code
Private Sub TimerRelogio_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerRelogio.Tick
        Me.lblTime.Text = Date.Now
    End Sub

Private Sub frmMDIParent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TimerRelogio.Start()
    End Sub

If You Like this tutorial,
please check out my other tutorials by clicking ==> here



* - ★Cooldude★ - Apr 30, 2010

Thank you very much for this, I was looking for it.


* - Voluxe - Apr 30, 2010

Or:

Quote:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.text = TimeOfDay
End Sub



* - ★Cooldude★ - Apr 30, 2010

(Apr 30, 2010 09:40 AM)Alex VS Alex Wrote:  Or:
Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.text = TimeOfDay
End Sub


Thanks, this is cleaner code.


* - codepoet - Apr 30, 2010

sorry my code was not noob friendly.....lol


* - ★Cooldude★ - Apr 30, 2010

(Apr 30, 2010 09:45 AM)crow407 Wrote:  sorry my code was not noob friendly.....lol

It's not that, not at all. It's just your code was for VB6.


* - iKorkSkalle - Apr 30, 2010

Very basic but good for newbies.

Spoiler (Click to View)


* - ★Cooldude★ - Apr 30, 2010

If you are using a status strip, use this:

Double click the top of your form and add this:

Code
timer1.start

Add a timer, double click it and add this code:
Code
ToolStripStatusLabel1.Text = TimeOfDay



* - Voluxe - Apr 30, 2010

(Apr 30, 2010 10:58 AM)cooldude255220 Wrote:  If you are using a status strip, use this:

Double click the top of your form and add this:

Code
timer1.start

Add a timer, double click it and add this code:
Code
ToolStripStatusLabel1.Text = TimeOfDay

Your just posted exacly what i posted. Just edited a word.


* - ★Cooldude★ - Apr 30, 2010

(Apr 30, 2010 11:03 AM)Alex VS Alex Wrote:  Your just posted exacly what i posted. Just edited a word.

Well give me another way I can show the time of day? When there is limited ways of doing things, then sometimes you will have to use the same code. And I didn't copy it either. I typed it out. Not a hard bit of code.


* - Mark Webber's B1tch - Apr 30, 2010

Very basic, but still nice.

Thanks for sharing mate.

✌


* - codepoet - Apr 30, 2010

no problem... i'm glad you like it

2short


* - codepoet - Apr 30, 2010

If You Like this tutorial,
please check out my other tutorials by clicking ==> here