How show current date & time in your application (C#)

Hello ...

Today I'm going to show you how add current date and time in your application .

First open your recent Windows form,


Go toToolbox and serch for "Timer" then drag & drop it. Timer is not a tool like button or label etc.

After add the time you can see it under the your form as separately.



Add a Label to your form where you want to show date & time. I change it name as time.

Double click on timer and go to codes, Enter code below..

DateTime dateTime= DateTime.Now;
this.time.Text = dateTime.ToString();


 Next go upper of your code & find the
InitializeComponent();
It is in your main Form method,

after find it you have to type this code

timer1.Start();

If you have any trouble please see the image below.


Now current Date & time will show in your application..


If You have any problem please leave a comment or message to me..








2 comments: