Microsoft KB Archive/189601

= PRB: Numeric Values Shift in Grid Column Containing NULL Values =

Article ID: 189601

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q189601



SYMPTOMS
A grid column that has its Sparse property set to .F. is bound to a numeric field that allows NULL values. When values in that column are edited and the grid is scrolled, values in that column may shift from left to right and back.



CAUSE
The default column Alignment setting is "3 [ASCII 150] Automatic". The column does not know whether to format the NULL values as character or numeric.



RESOLUTION
Change the grid column Alignment property to "1 - Middle Right". To demonstrate this behavior, place the following code in the Init event of the form: THIS.GRD1.COLUMN1.ALIGNMENT = 1



STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
  Run the following code from a program (.prg) file: PUBLIC OFORM1 CREA TABLE NULLTEST (F1 N(5,2) NULL) FOR LNI = 1 TO 5 INSERT INTO NULLTEST VALUES (NULL) ENDFOR USE NULLTEST

OFORM1=CREATEOBJECT("form1") OFORM1.SHOW RETURN

DEFINE CLASS FORM1 AS FORM

AUTOCENTER = .T.        HEIGHT = 268 WIDTH = 378 CAPTION = "Form1" NAME = "Form1"

PROC INIT THIS.GRD1.COLUMN1.TEXT1.NULLDISPLAY = "0" ENDPROC

ADD OBJECT GRD1 AS GRID WITH ; COLUMNCOUNT = 1, ; LEFT = 33, ; RECORDSOURCE = "nulltest", ; RECORDSOURCETYPE = 1, ; TOP = 28, ; NAME = "grd1", ; COLUMN1.SPARSE = .F., ; COLUMN1.NAME = "Column1" ENDDEFINE  Type the number 2 in the grid cell in the first row. Press the DOWN ARROW key. The 0 in the second row shifts left. Press the DOWN ARROW key again. The 0 in the second row shifts right. Press the UP ARROW key twice. The 0 in the second row shifts left again.</li></ol>

Additional query words: kbVFp300bbug kbVFp500abug kbVFp600bug

Keywords: kbprb kbcode KB189601

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.