Compartir a través de


Dynamically Format Grid Columns Sample

File: ...\Samples\Solution\Controls\Grid\Dyngrid.scx

This sample illustrates setting the DynamicForeColor and DynamicBackColor properties of grid columns.

The code of interest in this sample is associated with the InteractiveChange event of the drop-down list cboFormat.

First, the code clears the dynamic fore and backcolor settings:

oGrd.SetAll("dynamicbackcolor", "", "Column")
oGrd.SetAll("dynamicforecolor", "", "Column")

Then, code in a CASE statement sets the new DynamicForeColor or DynamicBackColor properties. For example, the following line of code displays discontinued items with a gray ForeColor.

oGrd.SetAll("dynamicforecolor", ;
   "IIF(discontinu, RGB(192,192,192), RGB(0,0,0))", "Column")

Discontinu is a logical field in the Products table.

See Also

Tasks

Display Calculated Values in a Column Sample

Display Child Records from a Relationship Sample

Display Controls in a Grid Sample

Other Resources

Controls Solution Samples