How to: Display the Time in a Label
This example displays the current time in a Label.
Example
private void displayTime()
{
Label1.Text = DateTime.Now.ToShortTimeString();
}
Compiling the Code
The form must contain a Labelnamed Label1.
See Also
Concepts
Designing a User Interface in Visual C#