Microsoft KB Archive/88232

{| = PRB: Pressing ENTER Key in Numeric GET Field Zeros the Field =
 * width="100%"|

ID: Q88232

This information in the article applies to:


 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
 * Microsoft FoxPro for Windows, version 2.5a

SYMPTOMS
Pressing the ENTER key in a numeric GET field overwrites the current value of the field with zeros.

CAUSE
The GET field has a PICTURE clause that begins with a decimal point character.

RESOLUTION
Specify a PICTURE clause that is wide enough to include all the digits in the field, including an implied digit before the decimal point.

MORE INFORMATION
The width of any numeric field that contains a decimal point must be at least 3: one place for each digit to the left and right of the decimal point, and one for the decimal point itself.

In a PICTURE clause that begins with a decimal point (for example, PICTURE

'.999'), the implied digit to the left of the decimal point is truncated because it does not fit in the picture. Even if the digit to the left of the decimal point is zero (for example, 0.12), pressing the ENTER key without specifying a value places 0.000 into the variable.

To correct this situation in the examples, change the PICTURE clause to read as follows: PICTURE '9.999'.

Additional reference words: FoxWin FoxDos 2.00 truncate cut off 2.50 2.50a KBCategory: kbprg kbprb KBSubcategory: FxprgGeneral
 * }