Reputation: 11104
I'm trying to make a field where user will enter amount of time per day he/she spent on a project per day. It can be from 30 minutes to 8 hours. Is DateTimePicker
with CustomFormat
hh:mm best choice for this? Or there's better alternative for WinForms C#? Maybe TextBox
or MaskedTextBox
with special settings?
Upvotes: 2
Views: 377
Reputation: 9726
If you're comfortable with it, I would build a custom control for this. Maybe a read only textbox where I display the formatted time spent, and 2 buttons, one for up, one for down that looked something like the old VB updown control. I'd suggest adding a minimum, maximum, and up / down interval properties also. This should be an easy enough control to do and it would go a long way towards simplifying the user input.
Upvotes: 2
Reputation: 273244
Although the MaskedTextBox is generally a pain, this is a situation it could be useful. With Mask="00:00". Give it a spin.
And you will have to convert to/from text to TimeSpan yourself
Upvotes: 1
Reputation: 712
How about a textfield with the format "7h 30m" (7 hours and 30 minutes)
Upvotes: 0