CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    46

    [RESOLVED] How to... StatusStrip Date, Clock

    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
    Attached Images Attached Images
    Last edited by MadSkillz; December 1st, 2009 at 01:58 AM.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How to... StatusStrip Date, Clock

    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 :
    Code:
    DateLabel.Text = Now.ToString("dd MMMM yyyy")
    TimeLabel.Text = Now.ToLongTimeString
    In the Timer's Tick event as well.

  3. #3
    Join Date
    Nov 2009
    Posts
    46

    Re: How to... StatusStrip Date, Clock

    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
    Last edited by MadSkillz; December 1st, 2009 at 03:31 AM.

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How to... StatusStrip Date, Clock

    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

  5. #5
    Join Date
    Nov 2009
    Posts
    46

    Re: How to... StatusStrip Date, Clock

    Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured