Dim formula1 as FormulaCondition =_ New FormulaCondition(Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0)) formula1.Formula = "[ConditionValue] < 4"
Conditional Formatting allows you to compare the cells of an entire column in WinGrid™ to one or more values and change the appearance if certain conditions are met. For instance, you can check to see if the cells are less than a specific number, or you can check to see if a certain string of text is contained within the cell. There are several operators that are built into the OperatorCondition object. However, you can build your own FormulaCondition with the help of the WinCalcManager™ component.
Building a formula condition is very similar to building a OperatorCondition. There are two constructors for the FormulaCondition object. One constructor takes an IFormulaProvider object, which will be the WinGrid column you are performing calculations on. Another constructor takes an IFormulaProvider and a formula string, which is the WinCalcManager formula you want to test the cell values against.
The following code instantiates a FormulaCondition object and sets the first column in the first band of WinGrid as the object to calculate the formula against. The formula itself is then set by using the Formula property.
In Visual Basic:
Dim formula1 as FormulaCondition =_ New FormulaCondition(Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0)) formula1.Formula = "[ConditionValue] < 4"
In C#:
FormulaCondition formula1 = new FormulaCondition(this.ultraGrid1.DisplayLayout.Bands[0].Columns[0]); formula1.Formula = "[ConditionValue] < 4";