Microsoft KB Archive/119691

= How to format telephone numbers with PICTURE mask =

Article ID: 119691

Article Last Modified on 5/10/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.6 for MS-DOS
 * Microsoft FoxPro 2.5b for Macintosh
 * Microsoft Visual FoxPro 2.5c for Macintosh

-



This article was previously published under Q119691



2.5x 2.6x 3.00 | 2.5x 2.60 2.60a | 2.5x 2.60a WINDOWS | MS-DOS | MACINTOSH kbtool kbprg



SUMMARY
The format of the data entry @ ... GET edit region for a telephone number can be controlled programmatically with a mask defined using the PICTURE clause, or it can be controlled in the Screen Builder or Form Designer by specifying the picture in the Format edit region of the Field dialog box. The examples shown below illustrate both methods.



MORE INFORMATION
The @ ... GET ... PICTURE clause provides the means of specifying a mask to control the format of data entered in a GET object in a window. The following paragraphs show examples of parameters of the clause that create a mask to control the format of a GET for entering a telephone number. These parameters provide all the customary nondata formatting characters (such as parentheses and dashes), but allow FoxPro to store only the numeric information so that the number is saved in just ten characters, either as a character field or as a numeric field. The parameters can be included either in a hard-coded "@ n.n GET  PICTURE ..." (without the quotation marks) command or they can be included in the Format box in the Field dialog box of FoxPro's Screen Builder.

FoxPro 2.x for Windows Examples
For example, if the telephone number is to appear on the screen as follows (these numbers are for example purposes only)

(213)123-1234

the PICTURE clause should appear as follows:

PICTURE "@R (999)999-9999"

The string to enter in the Format box in the Field dialog box is:

@R (999)999-9999

Likewise, if the telephone number is to appear as follows

213/123-1234

the mask should appear as follows:

@R 999/999-9999

Visual FoxPro for Windows Examples
For example, if the telephone number is to appear on the screen as follows (these numbers are for example purposes only)

(213)123-1234

Set the Format property to "R" (without quotation marks) and the InputMask property to the following:

(999)999-9999

Likewise, if the telephone number is to appear as follows

213/123-1234

the Format property should be "R" (without quotation marks) and the InputMask should appear as follows:

999/999-9999