How to Retain the ForeColor in a Grid For a Selected CellID: Q143307 3.00 3.00b WINDOWS kbprg kbhowto The information in this article applies to:
SUMMARYThis article shows by example how to maintain the changed ForeColor of a grid cell upon selecting a cell that has had its default forecolor changed (based on criteria of the data) to something other than the default.
MORE INFORMATIONThe following example shows how to have a selected cell in a grid retain its changed ForeColor upon selecting the cell, instead of the cell changing its color back to the default color.
Step-by-Step Example1. Create a new form and add the Customer table (located in Samples\Data) 2. Change the Grid1 ColumnCount property to 2.
3. Ensure that the Grid1 RecordSource property is Customer. 4. Ensure that the RecordSourceType property is 1 - Alias. 5. Change the Grid1 Column1 ControlSource property to customer.cust_id. 6. Change the Grid1 Column2 ControlSource property to customer.country. 7. Place the following code in Grid1 Column1 DynamicForeColor method:
8. Place the following code in the Grid1 Column1 Text1 GotFocus event:
9. Save and run the Form.
Using the up and down arrow keys, scroll through the grid and observe that the records having Germany in the Country column maintain red as the cells are selected - instead of changing to black. Remove the line of code in Grid1.Column1.Text1.GotFocus event, run the form, and observe that the selected Germany cell changes to black upon selection. Additional reference words: 3.00 3.00b VFoxWin KBCategory: kbprg kbhowto KBSubcategory: FxprgGeneral
|
Last Reviewed: February 2, 1996 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |