Share via


Using the InputMask Property to Control User Input

The InputMask property determines the characteristics of each character typed into the text box. For example, you could set the InputMask property to 999,999.99 to limit user input to numeric values less than 1,000,000 with two decimal places. The comma and the period would be displayed in the text box before the user entered any values. If the user pressed a character key, the character would not be displayed in the text box.

If you have a logical field and want a user to be able to type "Y" or "N" but not "T" or "F", set the InputMask property to "Y".

Accepting User Passwords in a Text Box

Often in an application, you want to obtain secure information from a user, such as a password. You can use a text box to get this information without making the information visible on the screen.

To accept user input without displaying the actual value

  • Set the PasswordChar property of the text box to * or some other generic character.

If you set the PasswordChar property to anything other than an empty string, the Value and Text properties of the text box contain the actual value that the user typed in the text box, but the text box displays a generic character for every key the user pressed.

Entering Dates in a Text Box

Text boxes have several properties that you can set to make it easy for your users to enter date values.

Property Description
Century Sets whether the first two digits of the year are displayed or not.
DateFormat Formats the date in the text box to one of fifteen predetermined formats, such as German or Japanese.
StrictDateEntry Sets StrictDateEntry to 0 - Loose. This makes it possible for a user to enter dates in more flexible formats than the default 99/99/99.

Common Text Box Properties

The following text box properties are commonly set at design time.

Property Description
Alignment Sets whether the contents of the text box are left justified, right justified, centered, or automatic. Automatic alignment depends on the data type. Numbers, for example, are right justified and characters are left justified.
ControlSource Specifies the table field or variable whose value is displayed in the text box.
InputMask Specifies the data entry rule each character entered must follow. For specific information about InputMask, see Help.
SelectOnEntry Sets whether the contents of the text box are selected automatically when the text box receives the focus.
TabStop Specifies whether the user can tab to the control. If TabStop is set to .F., a user can still select the text box by clicking it.

See Also

Accepting Input That Cannot Be Predetermined | Accepting Numeric Input in a Given Range | Using Controls | Allowing Specific Actions | Controls and Objects | Click Event