Sunday, April 3, 2011

Time only pickers for .NET WinForms?

There are tons of good date pickers out there for Windows forms, but I have yet to find any good time only pickers.

Any suggestions?


EDIT

I guess I should be more clear. I am talking about a nicer looking time picker. We use a commercial control suite, and the default time picker looks out of place because it is so plain.

From stackoverflow
  • You mean, as opposed to the standard Winforms DateTimePicker?

    this.dateTimePicker1.CustomFormat = "hh:mm";
    this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    

    ...

    private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
    {
        MessageBox.Show(dateTimePicker1.Value.TimeOfDay.ToString());
    }
    
  • DatePicker has a property Format that can be set to Time. Be sure to set ShowUpDown to True.

    Infragistics is pretty popular for Winforms and has the option for its DateTimePicker.

    ... setting the MaskInput to {time} should get the behavior you are looking for. If you only set the FormatString property, the the time will display only when the control is in edit mode (when the cursor is in the control).

    from http://forums.infragistics.com/forums/t/4172.aspx

0 comments:

Post a Comment