Click to See Complete Forum and Search --> : [RESOLVED] How to... StatusStrip Date, Clock


MadSkillz
November 30th, 2009, 11:48 PM
How can I add Date, Clock (and eventualy Progress Bar that loads when ListBox2 and ListBox3 are loaded) to this StatusStrip.

I added ProgressBar and 2 StatusLabels but the time and date don't refresh:

Private Sub StatusStrip_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles StatusStrip.ItemClicked

End Sub

Private Sub DateLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateLabel.Click

End Sub

Private Sub TimeLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeLabel.Click

End Sub

Private Sub ProgressBar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar.Click

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DateLabel.Text = Now.ToString("dd MMMM yyyy")
TimeLabel.Text = Now.ToLongTimeString
End Sub

HanneSThEGreaT
December 1st, 2009, 01:24 AM
It seems like you do not have a Timer component on your form, am I correct ¿

You will have to add a timer to your form, set the appropriate Interval for it ( 500 for example means half a second )

Then add this code :
DateLabel.Text = Now.ToString("dd MMMM yyyy")
TimeLabel.Text = Now.ToLongTimeString

In the Timer's Tick event as well.

MadSkillz
December 1st, 2009, 02:13 AM
Private Sub StatusStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles StatusStrip1.ItemClicked

End Sub

Private Sub ProgressBar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar.Click

End Sub

Private Sub DateLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateLabel.Click

End Sub

Private Sub TimeLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeLabel.Click

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DateLabel.Text = Now.ToString("dd MMMM yyyy")
TimeLabel.Text = TimeString
End Sub

Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
DateLabel.Text = Now.ToString("dd MMMM yyyy")
TimeLabel.Text = TimeString
End Sub

HanneSThEGreaT
December 1st, 2009, 02:36 AM
Is this resolved or what, please inform us. Do not just post some code and we don't know whether you still have issues, or this thread is resolved.

Also, use code tags when posting, as stated here :
http://www.codeguru.com/forum/showthread.php?t=403073

Thank you :)

MadSkillz
December 1st, 2009, 02:59 AM
Resolved