Representing Numbers and Dates
Numeric values and dates are most often presented in text boxes. As always, it's better to constrain the numeric values users can enter wherever possible. If the range of values is too broad, however, you might not be able to.
The Input Mask property in Access and the MaskedData control in Visual Studio provide a certain amount of control over numbers entered by means of a textboxyou can at least prohibit the entry of alphabetical characters. Access is also pretty smart about interpreting the data entered, but of course, this is after-the-fact data validation and not the best option if data limitation options are available.
Visual Studio provides two additional controls for entering calendar data, the MonthView control and the DateTimePicker control, shown in Figure 18-6. Access provides a calendar control similar to the MonthView control in Visual Studio.
Figure 18-6. The MonthView and DateTimePicker Controls
You can think of these controls as calendar equivalents of list boxes and combo boxesthe DateTimePicker displays the calendar only on demand, while the MonthView displays it at all times. Both controls handle only dates, however, not dates and times. This can lead to some odd complications when they're bound to Date/Time fields, so you need to be careful during implementation.
Visual Studio and Access also provide the Microsoft UpDown control (sometimes called a spinner control) that can be used for entering both numeric and Date/Time data. Most users will be familiar with UpDown controls from having set the date and time in Windows, as shown in Figure 18-7.
Figure 18-7. Windows Uses UpDown Controls for Controlling Time Values
UpDown controls are particularly useful if values are not incremented evenlya date that can only be on a weekday, for example, or a numeric value that must be rounded to the nearest hundred.
A final set of Visual Studio controls that can be used for entering numeric data includes slider controls and scroll bars, shown in Figure 18-8.
Figure 18-8. Slider Controls and Scroll Bars Have Limited Value in Database Applications
These controls have a fairly limited value in database applications. They're essentially only graphic mechanisms for setting numeric values, and as such could theoretically be used to enter any numeric data. (You probably don't think of scroll bars as numeric toolsthat's not their manifest modelbut they actually return numeric values to the application in the background.)
I find them most useful when users can compare a set of values whose relative position is more important than their precise valuesthat is, "This field value is more important than that field value." For example, I have occasionally used sliders for match checking, allowing users to set the relative importance or required tolerance of the fields to be compared in finding a match for a particular record.