hi,
i have problem wit displaying the time in my windows forms.
this is wat i have given

lblTime.Text = Datetime.Now.ToShortTimeString();

the problem wit this is once i open the application the time is shown, but it is not updating as it is in the system time.

so is ther any possibilty wher i can use the system timings and then keep it change every minute as it does in the sytem.

Use a timer to update the time every second. Set the execution interval to 1000 (1 second) and in the timer.OnTicket event have it call lblTime.Text = Datetime.Now.ToShortTimeString();

You should use the Timer control.

Change the properties of the timer as follows
Property Value
Interval 1000
Enabled True

And then handle the Timer.OnTick event.

Mention the code in this event this will help you in updating the time to current system time.

Hope my post has helped you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.