Tag Archives: hours

Use a symbiote to graphically select hours in C#

This example modifies the previous example Graphically select hours in C# so it uses a symbiote class. That example shows how to use a PictureBox to let the user select a range of hours. If you want to let the … Continue reading

Posted in controls, graphics, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Graphically select hours in C#

The DateTimePicker control lets you select dates and date ranges, but there’s no standard control that lets you select hours. This example shows one way to do this with a PictureBox. A big part of this program is the DrawHours … Continue reading

Posted in controls, graphics, user interface | Tagged , , , , , , , , , , , | 1 Comment

Find elapsed time in years, months, days, hours, minutes, and seconds in C#

The TimeSpan structure represents an elapsed time. It has Days, Hours, Minutes, Seconds, and Milliseconds properties that tell you about the time that has passed. For example, if two dates are 3 days and 4 hours apart, then Days = … Continue reading

Posted in parsing, variables | Tagged , , , , , , , , , , , , , , , , , | Leave a comment

Find the days, hours, minutes, or seconds between two dates in C#

This example uses a TimeSpan to find the days, hours, minutes, or seconds between two dates. When the user changes the date text, the program executes the following code. // If the text is a date, display // the elapsed … Continue reading

Posted in parsing, variables | Tagged , , , , , , , , , , , , , | Leave a comment