Click here to Skip to main content
15,311,151 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want to display the running system time on the top of the user form where they will enter the data. please guide...
Posted
Comments
[no name] 31-May-12 6:53am
   
String s=System.Convert.ToString(DateTime.Now);

Are you using winforms? If yes then put a label and timer on form. set the timeout to 1 second and then in the tick event set the labels text to the current time using datetime object.

in case of webforms: use javascript time object in conjunction with Setinterval or settimeout function to do the same.
   
v2
C#
in form u can take one label
in code behind u can write like this.
label1.Text = DateTime.Now.ToString();
   
Dear you can use Datetime Function to set the datetime of System.

String s=System.Convert.ToString(DateTime.Now);
   
Comments
MAKReddy 31-May-12 6:59am
   
this is also correct.
subhankar ruj 31-May-12 7:00am
   
Boss, I want to display the running time like 12:00:01, next moment it must change as system time will change like 12:00:02
[no name] 31-May-12 7:02am
   
so you can use the Timer and in Timer Tick event you use
Label1.Text=System.Convert.ToString(DateTime.Now);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900