Microsoft KB Archive/194573

= BUG: Grid Shows Only Two Added Records When Buffering/Order Set =

Article ID: 194573

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q194573



SYMPTOMS
You have a grid with its RecordSource property set to a table with buffering enabled and an order set. If you add more than two records to the table, the records do not display in the grid until the grid gets focus.



RESOLUTION
Issue one of the following commands after adding the record: GO BOTTOM -or- THISFORM.grid1.SCROLLBARS = THISFORM.grid1.SCROLLBARS Note that the second command requires modification depending on the exact location of the grid in the object hierarchy.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



Steps to Reproduce Behavior
  Run the following code from a program (.PRG) file: CREATE TABLE junk (f1 c(8)) INDEX ON f1 TAG f1     SET MULTILOCKS ON      =CURSORSETPROP('buff', 5)   && anything > 1

PUBLIC oform oform = CREATEOBJECT('form1') oform.SHOW

DEFINE CLASS form1 AS FORM AUTOCENTER = .T.        HEIGHT = 315 WIDTH = 415 CAPTION = "Form1"

ADD OBJECT grid1 AS GRID WITH ; LEFT = 26, ; RECORDSOURCE = "junk", ; RECORDSOURCETYPE = 1, ; TOP = 19

ADD OBJECT command1 AS COMMANDBUTTON WITH ; TOP = 252, ; LEFT = 156, ; HEIGHT = 27, ; WIDTH = 84, ; CAPTION = "Add Record"

PROCEDURE UNLOAD =TABLEREVERT(.T.) USE IN junk ENDPROC

PROCEDURE command1.CLICK INSERT INTO junk VALUES (SYS(3))

* The following GO BOTTOM command will cause the records *   to appear * GO BOTTOM

* Setting the value of the grid ScrollBars property to itself *   will also cause the records to appear * THISFORM.grid1.SCROLLBARS = THISFORM.grid1.SCROLLBARS THISFORM.REFRESH ENDPROC

ENDDEFINE  Click the Add Record button several times.

The first two added records show, the third and subsequent records do not. Clicking in the grid to place the focus in the grid will allow all the records to be displayed.

To demonstrate the workaround, you may uncomment either the GO BOTTOM command or the ThisForm.Grid1.scrollbars = ThisForm.Grid1.scrollbars command. This will cause all the records to be displayed.

