Representing Text Values
Finally, we turn to those controls of last resort, text boxes. Text boxes aren't evil; they're just overused. Most data in a typical database is textual, and text boxes are the appropriate controls for representing those values. The exception is when the field is a foreign key, in which case a combo box or list box is usually a better choice, as described earlier.
The basic principles of choosing controls apply equally to text boxes: Use them when they match the users' mental model, and employ whatever data limitation techniques are possible.
Data limitation is provided in Access by the Input Mask property of the text box control. It isn't directly supported in the current version of Visual Studio. Input masks allow you to specify a pattern that controls the form of data entered. An American social security number, for instance, follows the pattern ###-##-#### (three digits, a dash, two digits, a dash, and four digits).
Input masks are useful in certain situations, but these situations are less frequent than some people seem to think, and it's easy to limit the data entry too much. Phone numbers are a good example: It's tempting to use an input mask for these values, but before doing so you must make sure that the system needs to accept phone numbers only from within the same country. Phone numbers in different countries often do not have the same format. Even within a single country, you need to think about possible variationsextensions and access numbers, for example, or simply different conventions. (It used to make me crazy that in Australia some people format a seven-digit number as 999-9999 and some use 99-99-999 instead.)
Remember, your goal in providing an input mask is to make life easier for users. Preventing them from entering perfectly validbut unexpectedvalues is a hindrance.
In addition to standard text boxes, both Access and Visual Studio support using a Microsoft Rich Textbox control for entering text that combines different typefaces and styles. Implementing a Rich Textbox control is more complex than using other controls because you must also provide an interface for setting the text properties.
In addition to the added complexity in the interface, a Rich Textbox control also adds some complexity to the data manipulation, since the text formatting is embedded in the control. For this reason, I recommend restricting the use of Rich Textbox controls to situations in which the added functionality is of tangible benefit to users. Furthermore, you should use them only for values that will be treated as "chunks" of text that are displayed in various places but are not searched or joined with other values.
For example, rich text can be useful for managing boilerplate paragraphs of text that are combined to produce standard letters. The actual paragraphs to be included would be stored as rich text but chosen by users on the basis of descriptive or categorical information stored as standard, unformatted text.