Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 335
TWA Avatar asked Jun 25 '09 21:06

TWA


People also ask

How do I use DateTimePicker in Windows form?

The Windows Forms DateTimePicker control allows the user to select a single item from a list of dates or times. When used to represent a date, it appears in two parts: a drop-down list with a date represented in text, and a grid that appears when you click on the down-arrow next to the list.

How do I convert date picker to time?

Solution 3. string str = string. Format("dd-MM-yyyy"); string ab = date. ToString(str);

What is date/time picker in C#?

A DateTimePicker control allows users to select a date and time in Windows Forms applications. In this tutorial, we will see how to create a DateTimePicker control at design-time as well as at run-time, set its properties and call its methods.


2 Answers

You mean, as opposed to the standard Winforms DateTimePicker?

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

...

private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
    MessageBox.Show(dateTimePicker1.Value.TimeOfDay.ToString());
}
like image 55
Michael Petrotta Avatar answered Nov 11 '22 04:11

Michael Petrotta


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

like image 23
blu Avatar answered Nov 11 '22 03:11

blu