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?
views:
76answers:
3I would like it to be Localized and used with ease by users, with low or even none possibility for error.
MadBoy
2010-03-19 20:00:21
+1
A:
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
Henk Holterman
2010-03-19 20:08:53
+2
A:
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.
Beaner
2010-03-19 20:15:33
@MadBoy - It is not hard, here is a simple custom control tutorial: http://www.codeproject.com/KB/miscctrl/cutebutton.aspx. Have a look at it. Basically I am suggesting you combine several standard controls into one, add a few custom properties and enable you users to click an up button to add time in say 15 minute increments.
Beaner
2010-03-19 20:25:42
Will give it a go when project is a bit more advanced. Right now i need to do it quickly, later on i'll tune things up. Thanks :)
MadBoy
2010-03-19 20:43:10