Coding Support
Read Ad-free Manga, Manhwa, and Manhua at https://trilliux.me!

You are not connected. Please login or register

View previous topic View next topic Go down Message [Page 1 of 1]

1
how i make clock in c#? Empty how i make clock in c#? Thu Jun 06, 2013 9:29 pm

Shercules

avatar
CS Member
sir please help me make clock this is very useful to me please help!!!

2
how i make clock in c#? Empty Re: how i make clock in c#? Thu Jun 06, 2013 9:31 pm

Support

Support
Site Admin
Use this:

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Timer_Example
{
    public partial class fclsTimerExample : Form
    {
        public fclsTimerExample()
        {
            InitializeComponent();
        }

        private void fclsTimerExample_Load(object sender, EventArgs e)
        {
            DateTime dtCurrentTime = DateTime.Now;
            lblClock.Text = dtCurrentTime.ToLongTimeString();
             
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            DateTime dtCurrentTime = DateTime.Now;
            lblClock.Text = dtCurrentTime.ToLongTimeString();


        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void tabPage1_Click(object sender, EventArgs e)
        {

        }

        private void tmrDate_Tick(object sender, EventArgs e)
        {
         
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}

Code:
// Given that the user enters correct date and time
modifiedDate = DateTime.Parse( textBox1.Text );

Code:
private void timer1_Tick(object sender, EventArgs e)
{
  // Add the seconds interval you have specified in the Timmer.
  // I am adding 1 second
  modifiedDate = modifiedDate.AddSeconds(1);
  lblClock.Text = modifiedDate.ToLongTimeString();
}

Code:
// Class Definition
private DateTime modifiedDate = DateTime.Now

Using this code should work Very Happy

https://twzforums.forumotion.com

3
how i make clock in c#? Empty Re: how i make clock in c#? Thu Jun 06, 2013 9:35 pm

Shercules

avatar
CS Member
thank you sir!!!!!!!!!
Very Happy Very Happy Very Happy Very Happy

4
how i make clock in c#? Empty Re: how i make clock in c#? Thu Jun 06, 2013 9:41 pm

Support

Support
Site Admin
~Topic solved and locked

https://twzforums.forumotion.com

Sponsored content


View previous topic View next topic Back to top Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum