public enum ResultEnum : short
Open = 1,
Won = 2,
Lost = 3,
Void = 4,
DeadHeat = 5
}
I want to set the cell's Forecolor to Green if the Result is WON and to Red if the Result is LOST. Since the DataType of the column is set to the enum above, in the ValueBasedAppearance designer window, when I try to add a Operator Condition, I am not able to assign a value as whatever I type is treated as a string. I added a formula condition [Result] = 2 (for Won) and [Result] = 3 (for Lost) and that works. Is there a way I can use the Enumeration values instead of having to type the integer values?
Oh sorry, I see you was taking about the designer. My example is from code. I did not use this designer so far.
Thanks... That's what I am looking for, but I get a syntax error in the Formula Builder when I try the above. I've tried various other possibilities as well... Is this the syntax you used?
I have done this for similar cases using type casts :
[Result] = Convert.ToInt32( ResultEnum.Open )
This gives more readable and "changesafe" code. Is this what you are looking for ?