Run a Digital Clock on your WinForm

后端 未结 1 890
执念已碎
执念已碎 2020-12-03 16:06

Hi I have to design a Windows Form which has a simple textbox. The textbox contains a timer like text (00:00 format).

I want to refresh the page every second and mak

相关标签:
1条回答
  • 2020-12-03 16:26

    Set the timer and the refresh period. (1 second)

    timer1.Enabled = true;
    timer1.Interval = 1000;
    

    Then you need to implement what you want the timer to do every 1 second:

    private void timer1_Tick(object sender, EventArgs e)
    {
        DigiClockTextBox.Text = DateTime.Now.TimeOfDay.ToString();
    }
    
    0 讨论(0)
提交回复
热议问题