PRB: Grid Column's CurrentControl Reverts to Text1 DefaultID: Q132478 3.00 WINDOWS
The information in this article applies to:
SYMPTOMSWhen you use the SQL SELECT command, and set the grid's RecordSource property to the newly queried cursor file, the grid column's current control (Check1 for example) reverts to Text1 (the default control).
CAUSEThe SQL SELECT code includes a SELECT ... INTO CURSOR TESTCURSOR command, which is the RecordSource for the grid. When this happens, the original cursor must be destroyed before the new cursor can be created. When the orginal cursor is destroyed, the grid columns and the controls in the columns are also destroyed, as well as the check box. In this case, the check box is destroyed. The SQL SELECT code sets the grid's RecordSource to the new cursor. At this point, the columns are automatically created with the default settings. There is no code to recreate the check box.
WORKAROUNDTo retain the controls in the grid columns, add the following statement prior to executing the SQL SELECT command:
For more information, please see the example workaround in the More
Information section of this article.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior1. Issue the following commands:
2. Create a form named Test.
3. Add the Testdbf table to the Test form's Data Environment. 4. Drag the Testdbf table to the form. A grid is added to the form. 5. Set the following PEMs (properties, events, and methods) for the grid:
6. Select Grid1.Column1 in the Properties window.
7. Click the check box tool on the toolbar. On the grid, Check1 should 8. Change the Grid1.Column1.CurrentControl property to Check1.
9. Add a text box to the form. 10. Add a command button to the form, and set the following PEMs:
11. In the Form1.Load event, add this line of code:
12. Save and run form. The grid is populated with "North" records only, and
13. Type "South" (without the quotation marks) in the text box.
14. Click the SQL button. 15. Widen the ID column. The grid is populated with the "South" records
Example Workaround1. Modify the Test form. 2. In the Command1.Click event, add the following statement prior to 3. Type the CLEAR ALL command in the Command window.
4. Save and run the form. 5. Type "South" in the text box. 6. Click the SQL button. Now the grid is populated with the "South" records Additional reference words: 3.00 VFoxWin refresh
KBSubcategory: FxotherGeneral
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |