Crystal Reports – Conditionally supress a Line object

Crystal Reports seem to be a bit like Marmite, people either love it or hate it! I’m actually quite indifferent, sure there are a number of bug-bears and ‘quirks’ to put up with, but at the end of the day it’s free and it’s what I’m stuck using, so I have little option but to get on with it and make do the best I can.

One particularly irksome feature is the lack of an option to conditionally suppress a Line or Box object, especially when you have a report with multiple total fields that are all underlined with a Line object as I do! It may be possible to draw a line object using a formula, I’m not sure, but an easier alternative is to display your total in a Textbox object, set only the bottom border and then suppress the Textbox using a formula as per usual.

Databind an Enum to a Combobox

Array enumValues = Enum.GetValues(typeof(your enum type here));
ArrayList enumList = new ArrayList();

foreach (Enum value in enumValues)
    enumList.Add(new KeyValuePair<Enum, string>(value, value.ToString()));

ComboBox.DataSource = enumList;

“DisplayMember” and “ValueMember” properties can then be set on the combobox to point to the Key and Value properties of the enumlist.