How to Capitalize Some Characters in a Text Box AutomaticallyID: Q148918 3.00 3.00b WINDOWS kbtool kbhowto The information in this article applies to:
SUMMARYWhen typing names into a text box, you can have the first letter of each word automatically capitalized. This can be done in the KeyPress event by checking each character that is typed and capitalizing it if it is the first character entered or if the character before it is blank. Names such as "Van Camp" would have the first letter of each part of the name automatically capitalized. However, names like "MacDonald" would still require that you manually capitalize the D key.
MORE INFORMATION
Step-by-Step ProcedureThe following steps illustrate how to use the KeyPress event to check each character and enforce the rule that the first character of each word be capitalized. 1. Create a new form, and place a text box on it. 2. Create a new property for the form. On the Form menu, click New 3. In the When Event of the text box, place the following code:
4. In the KeyPress event of the text box, place the following code:
5. Run the form, and type the following into the text box:
6. Backspace over the whole name, and start typing another name. Note that
Additional reference words: 3.00 3.00b VFoxWin
KBCategory: kbtool kbhowto
KBSubcategory: FxtoolFormdes
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |