0

I'm trying to format the string in the expression for the Style Format Condition to paint the background color of the cell with some color if the condition it's true. My condition it's only to compare if the substraction of two values is equal to another value, I execute the comparison like this because the values are double and it's necessary to avoid precision errors, where EPSILON is 0.001:

if (Math.Abs(rvalue - tara - value) > EPSILON)
{
   // do something
}

I'm trying this code , but doesn't work, please if someone can do this, please help me. Thanks

var condExpression = new StyleFormatCondition(FormatConditionEnum.Expression);
condExpression.Column = gv_MateriaPrima.Columns[3];
condExpression.Appearance.BackColor = Color.OrangeRed;
condExpression.Expression = String.Format("Abs([FieldName] - {0} - {1}) > {2}",
value1, value2, EPSILON);
4

1 に答える 1