void InitRebateTypes() { RebateTypes.Clear(); OIRebate = new RebateType("OI"); RebateTypes.Add(OIRebate); BBRebate = new RebateType("BB"); RebateTypes.Add(BBRebate); ScanRebate = new RebateType("Scan"); RebateTypes.Add(ScanRebate); OtherRebate = new RebateType("Other"); RebateTypes.Add(OtherRebate); List <DevExpress.XtraEditors.ComboBoxEdit> combos = new List <DevExpress.XtraEditors.ComboBoxEdit>(); combos.AddRange(new DevExpress.XtraEditors.ComboBoxEdit[] { cmbRebateType, cmbRebateType1, cmbRebateType2, cmbRebateType3, cmbRebateType4, cmbRebateType5 }); foreach (DevExpress.XtraEditors.ComboBoxEdit edit in combos) { edit.Properties.Items.Clear(); foreach (RebateType rt in RebateTypes) { edit.Properties.Items.Add(rt); } edit.SelectedIndex = 0; } }
void SelectRebateComboSelection(DevExpress.XtraEditors.ComboBoxEdit control, RebateType rebateType) { if (rebateType == null) { return; } int i = 0; foreach (RebateType r in control.Properties.Items) { if (r.ToString() == rebateType.ToString()) { control.SelectedIndex = i; return; } i++; } }