FarPoint Technologies
(800) 645-5913
fpsales@fpoint.com
FarPoint Europe (UK)
+44 (0) 1798 812 372
salesEurope@fpoint.com
|
|
The fpDateTime control displays and formats date
and time values. Date and time values can be set and returned independently. To
simplify data entry, you can customize the fpDateTime control, restricting the
values allowed in the control and formatting dates as you prefer. You can use a
predefined format or define your own date/time format.
The fpDateTime control offers a calendar feature that lets the user see a month
at a time (for example) and select a date. The control can display a pop-up
calendar or a drop-down calendar, and you can customize the appearance of the
calendar. Alternatively, the control can display a clock, or both a calendar
and a clock. You can also add buttons to an fpDateTime control to customize
user interaction.
Setting and Returning Date and Time Values
| Providing Buttons |
Validating Date/Time Data | Formatting
Date/Time Values | Providing a Calendar
or Clock | Customizing User Entry
Back to Top
| The fpDateTime control provides a number of
properties that set and return date and time values, together or separately. In
addition, the fpDateTime control provides a function or method that lets you
return an adjusted date value, such as the date 10 days from the current date.
|
 |
| To set date and time values |
| |
Set the Text property |
| To return date and time values, use the
property
|
| Text |
Returns the date and time as a formatted string |
| UnFmtText |
Returns the date and time in the format "YYYYMMDD
HHNNSS" |
| Value |
Returns the date and time as a value of the double
data type in the format "ddddd.tttttttt", where "ddddd" represents the date
value in the date serial format and "tttttttt" represents the time value in the
time serial format. Date values prior to 12/30/1899 have negative date serial
values. For example, the date 12/29/1899 has a date serial value of -1. |
| To set or return the complete date value |
| |
Set or return the DateValue property using the
format "YYYYMMDD" |
| To return an adjusted date value |
| |
Call the DateAdjustDate function and provide
the date value to adjust in the Date or DateString parameter, and the amount by
which to adjust the date in the YearAdjust, MonthAdjust, and DayAdjust
parameters. |
| To set or return a part of the date value |
| |
Set or return the day, month, or year using the Day,
Month, or Year properties |
| To set or return the complete time value |
| |
Set or return the TimeValue property using the
format "HH:NN:SS.xx", where "HH" stands for hours, "NN" for minutes, "SS" for
seconds, and "xx" for hundredths of a second |
| To set or return a part of the time value |
| |
Set or return the hours, minutes, or seconds using
the Hour, Min, or Sec properties |
|
|
Back to Top
The fpDateTime control can display buttons to let
the user quickly change the value of the control without typing.
You can choose which type of buttons to display and the amount by which the
value of the control changes when the user clicks a button.
The drop-down button, the pop-up button, and spin buttons all have default
behaviors for the fpDateTime control. The drop-down and pop-up buttons let the
user display a calendar for the month of the date value of the control or a
clock for the time value. Spin buttons increment and decrement the date and
time values of the control depending on the location of the cursor. |
 |
|
Back to Top
NOTE: Be sure to read the Customizing
User Entry section below for information on validation of data while
being entered by the user.
When the fpDateTime control loses the focus, it checks the
value of the control to see whether it is valid. Any value other than a valid
date or time is invalid; for example, "January 32, 1994" is invalid. If an
invalid value is received, an InvalidData event occurs after the control
loses the focus.
However, if the user provides an incomplete date/time value, the fpDateTime
control can supply missing values and delete extra characters to correct the
date and time when it loses the focus. You can specify how the missing date or
time values are calculated using the DateCalcMethod property.
You can create an fpDateTime control that limits the range of dates and times
that the user can type. Any date/time value that is larger than the maximum or
smaller than the minimum date or time value is treated as invalid. You can
change the fpDateTime control's appearance to reflect that it has received
invalid data. In addition, you can specify whether and how invalid data is
displayed. You can also specify whether the control allows the Null value. |
|
Back to Top
You can create an fpDateTime control that
displays a date only, a time only, or a combination of the two. You specify the
format for the value by selecting a predefined format or creating a
user-defined format.
If you do not specify a date/time format for the control, the format defaults
to the international or regional Windows settings. When you specify the
international format, the control displays the format chosen in the Windows
international or regional settings for the system. Time values default to the
current international setting. You can specify that time values be displayed as
12-hour or 24-hour values.
You can specify whether morning and evening indicators are displayed with the
date and time values for user-defined date/time formats. You can also provide
different text to display for the short and long day and month names. |
 |
|
Back to Top
You can provide a calendar or clock, or both, for
the fpDateTime control. By default, the fpDateTime control provides a pop-up
calendar. You can use other default behaviors for the calendar and clock, or
you can set specific behaviors, including writing your own code for the
behavior or canceling the calendar or clock. You can also customize the
appearance of the calendar, such as the changing the time interval and style of
the headings.
The user can display the calendar or clock at any time by clicking the right
mouse button while the pointer is over the fpDateTime control, pressing the F4
key, or clicking the pop-up or drop-down button (if provided) on the fpDateTime
control.You can also display the calendar or clock for the user at a particular
time by setting the Action property to 7 (Pop-Up) in your code.
|
 |
|
Back to Top
If the UserEntry property is set to 0 (Formatted),
the control checks each character as the user types it or when it is pasted
into the control. If the user tries to type or paste a character that is not
valid for the control, the control does not accept the character, and a UserError
event occurs. You can also configure the control to beep when the user supplies
an invalid character.
The fpDateTime control accepts only numbers and letters that specify a valid
date or time, accompanied by valid separator characters. The user can type any
of the following characters to indicate distinct data, such as to separate
month values from day values: comma (,), hyphen (-), slash (/), period (.),
colon (:), space, and backslash (\). Regardless of which separator character
the user types, the fpDateTime control displays separator characters according
to the defined format.
The characters that the fpDateTime control considers invalid depend on the
date/time format. By default, the fpDateTime control uses the short date format
specified in the Windows international or regional settings. You can change the
format used by the fpDateTime control.
The user does not have to type the date and time in the specified format unless
the UserEntry property is set to 0 (Formatted). The fpDateTime control
formats the date correctly when the control loses the focus. For example, when
using the short date format, if the user types "July 4, 1994", the fpDateTime
control formats the value as "7/4/94" when the control loses the focus.
|
|
|
 |
|
 |
|
|
| Have a question? |
|
 |
|