A cursor-based grid is blank if the SELECT-SQL command resets the cursor in Visual FoxPro (140653)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Macintosh 3.0b
- Microsoft Visual FoxPro for Windows 7.0
- Microsoft Visual FoxPro 8.0
- Microsoft Visual FoxPro 9.0 Professional Edition
This article was previously published under Q140653 SYMPTOMSIn Microsoft Visual FoxPro, if the RecordSource property of a grid is set to a cursor, and then the
SELECT-SQL command resets the cursor, the grid appears blank if the
RecordSource property is not set back to itself.
The following command will refresh the grid properly if a SELECT-SQL is run
to rebuild the cursor, but if the column or header properties of the grid have
been customized, these customized changes will be lost and the column and header properties of the grid will change back to their default settings:
THISFORM.GRID1.RECORDSOURCE=THISFORM.GRID1.RECORDSOURCE
Such customization could be headers with different names, longer column
lengths, and code placed in the events of columns or headers. For more
information, please see the following article in the Microsoft Knowledge
Base:
131836 PRB: Grid Not Refreshing Displaying a Cursor from Query
CAUSE
When you rebuild the cursor that the grid is based on with the SELECT-SQL
command, the original cursor has to be destroyed before the new cursor can
be created. When this happens, the grid columns and headers are also
cleared and then recreated. Even when the RecordSource property of the grid is set back
to itself, the custom settings of the columns and headers of the grid are lost.
RESOLUTION
To refresh the grid without losing the custom properties of the columns and
headers, set the RecordSource property to a dummy cursor that already has
been created with the same fields as the cursor the grid is based on. After
the SELECT-SQL is run, change the RecordSource property back to the rebuilt
cursor. This allows the properties of the columns and headers to remain
intact while the cursor is being rebuilt.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 3/10/2005 |
---|
Keywords: | KB140653 |
---|
|