Type | Description | |||
Expression as String | A formal expression that indicates the formula being used when the format is applied. Please check the Expression property that shows the syntax of the expression that may be used. For instance, the "%0 >= 10 and %1 > 67.23" means all cells in the first column with the value less or equal than 10, and all cells in the second column with a value greater than 67.23 | |||
Key as Variant | A string or long expression that indicates the key of the expression being added. If the Key parameter is missing, by default, the current index in the ConditionalFormats collection is used. |
Return | Description | |||
ConditionalFormat | A ConditionalFormat object that indicates the newly format being added. |
The conditional format feature may change the cells and items as follows:
The following VB sample bolds all items when the sum between first two columns is greater than 0:
ComboBox1.ConditionalFormats.Add("%0+%1>0").Bold = True
The following VB sample bolds the cells in the second column ( 1 ), if the sum between second and third column ( 2 ) is less than the value in the first column ( 0 ):
With ComboBox1.ConditionalFormats.Add("%1+%2<%0") .ApplyTo = 1 .Bold = True End With
The following C++ sample bolds all items when the sum between first two columns is greater than 0:
COleVariant vtEmpty; m_combobox.GetConditionalFormats().Add( "%0+%1>0", vtEmpty ).SetBold( TRUE );
The following C++ sample bolds the cells in the second column ( 1 ), if the sum between second and third column ( 2 ) is less than the value in the first column ( 0 ):
COleVariant vtEmpty; CConditionalFormat cf = m_combobox.GetConditionalFormats().Add( "%1+%2<%0", vtEmpty ); cf.SetBold( TRUE ); cf.SetApplyTo( 1 );
The following VB.NET sample bolds all items when the sum between first two columns is greater than 0:
AxComboBox1.ConditionalFormats.Add("%0+%1>0").Bold = True
The following VB.NET sample bolds the cells in the second column ( 1 ), if the sum between second and third column ( 2 ) is less than the value in the first column ( 0 ):
With AxComboBox1.ConditionalFormats.Add("%1+%2<%0") .ApplyTo = 1 .Bold = True End With
The following C# sample bolds all items when the sum between first two columns is greater than 0:
axComboBox1.ConditionalFormats.Add("%0+%1>0", null).Bold = true
The following C# sample bolds the cells in the second column ( 1 ), if the sum between second and third column ( 2 ) is less than the value in the first column ( 0 ):
EXCOMBOBOXLib.ConditionalFormat cf = axComboBox1.ConditionalFormats.Add("%1+%2<%0",null); cf.Bold = true; cf.ApplyTo = (EXCOMBOBOXLib.FormatApplyToEnum)1;
The following VFP sample bolds all items when the sum between first two columns is greater than 0:
thisform.ComboBox1.ConditionalFormats.Add("%0+%1>0").Bold = .t.
The following VFP sample bolds the cells in the second column ( 1 ), if the sum between second and third column ( 2 ) is less than the value in the first column ( 0 ):
with thisform.ComboBox1.ConditionalFormats.Add("%1+%2<%0") .Bold = .t. .ApplyTo = 1 endwith