public static void SetValues(this CComboBoxEdit cComboBoxEdit, List <CComboBoxEditValue> values) { if (values != null && values.Count == 0) { return; } values.ForEach(a => cComboBoxEdit.SetValue(a)); }
public static string GetSelectedValue(this CComboBoxEdit cComboBoxEdit) { try { return((cComboBoxEdit.SelectedItem as CComboBoxEditValue).ID); } catch { return(null); } }
public static void SetSelected(this CComboBoxEdit cComboBoxEdit, string id, bool first = false) { if (cComboBoxEdit.Properties.Items.Count == 0) { cComboBoxEdit.SelectedIndex = -1; } else if (first) { cComboBoxEdit.SelectedIndex = cComboBoxEdit.Properties.Items.Count > 0 ? 0 : -1; } else { for (int i = 0; i < cComboBoxEdit.Properties.Items.Count; i++) { if ((cComboBoxEdit.Properties.Items[i] as CComboBoxEditValue).ID == id) { cComboBoxEdit.SelectedIndex = i; } } } }
public static void SetValue(this CComboBoxEdit cComboBoxEdit, CComboBoxEditValue value) { if (value == null) { return; } var rows = cComboBoxEdit.Properties.Items; rows.BeginUpdate(); try { rows.Add(value); } finally { rows.EndUpdate(); } cComboBoxEdit.SelectedIndex = -1; }
public static void SetFirst(this CComboBoxEdit cComboBoxEdit) { SetSelected(cComboBoxEdit, "", true); }