DateTimePicker
The DateTimePicker control allows the user to pick a time or date value using an editable field to set the Time, or a calendar selector for the Month, Day, and Year components.
Properties
Key properties of DateTimePicker include:
- DisplayDate. Today’s date is the default display date, however a different default date may be specified.
- DisplayDateStart and DisplayDateEnd. A date range may be specified for validation purposes.
- Selected Date. The date last selected in the form can be passed as a parameter in a VB or C# script.
- Format. The format for the date can be set to Short, Long or Custom; or Time can be selected.
Events
Key events associated with a DatePicker include:
- SelectedDate. A VB or C# script can be configured for execution when a date is selected.
For information on configuring events and other components of the design using a script, see: Working with Scripts.
Adding a DateTimePicker
When you add a DateTimePicker to a form, today's date is displayed by default.
The Properties for the DateTimePicker control can be used to change the default display date, as well as limit the range of dates that can be selected and choose a format.
To select a date on a form, click on the Calendar icon to open the calendar. Use the arrow controls to select the Month and Year and then select a Day of the Month.
If the Custom format is selected, the precise format can be defined in the CustomFormat property.
The format for the DateTimePicker can be set to Time to provide a field for selecting the time.
The Time can be set directly into the field by selecting the Hours, Minutes, Seconds and AM/PM component and entering the desired values.
Information on the Properties and Events for the DateTimePicker control can be found at the link to Microsoft® Documentation.