Friday, 25 April 2014

Dynamically display Current date and time in window form


                                                                                                                                          Previous..
                                                                                                                                                Next..

Here i will explain how to display current date and time by using code in window form.

Step(1):- Form
Drag and down a Leble and a timer from toolbox. when you drag and down a timer it will go down. you can change its property like interval.
Step(2):- Code

Double click on timer and write this code


Private void timer_Tick(object sender, EventArgs e)
{
DateTime datetime = DateTime.Now;
this.time_lbl.Text = datetime.ToString();
}
Private void time_lbl_Click(object sender, EventArgs e)
{

}
And you go at  " InitilizeComponent" and write below this
        timer1.start();

Step(3):- Output

Now run your application
                                                                                                                                          Previous..
                                                                                                                                                Next..

No comments:

Post a Comment

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...