HI FRIENDS !!
In my last post we are
learn about analog clock but now we are
going to creating digital clock.
We are using visual studio and take label from tools and one
timer also for match the system date and time.
Like this picture:
Now we are going to coding path we are using C# language
which is .net supported language .
using System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace d_clock
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void label1_Click(object
sender, EventArgs e)
{
}
// here we are using timer_tick event for match are time with
system date //or time
private
void timer1_Tick(object
sender, EventArgs e)
{
label1.Text = System.DateTime.Now.ToString();
}
// here we are using form load event for starting our timer when
form //load
private
void Form1_Load(object
sender, EventArgs e)
{
timer1.Start();
}
}
}
Then the output is like this picture:
THANK YOU !
0 comments:
Post a Comment