public static int GetSelectedFormatFromCombo(System.Windows.Forms.ComboBox comboBoxCtrl) { string itemText = comboBoxCtrl.GetItemText(comboBoxCtrl.SelectedItem); foreach (WiaSupportedFormatsInfo i in _wiaFormatsInfo) { if (itemText == i.Format.ToString()) { _format = i.Format; return(1); } } return(0); }
public int FindStringExact(String strText) { try { for (int i = 0; i < cb.Items.Count; i++) { if (strText == cb.GetItemText(cb.Items[i])) { return(i); } } } catch (Exception ex) { throw new System.Exception("Error finding String. KAL.Handheld.Controls.ComboBox.FindExact", ex); } throw new System.Exception("Entry not found in drop down"); }
public static int SelectFormatFromCombo(System.Windows.Forms.ComboBox comboBoxCtrl, System.Guid guidFormat) { int ret = GetFormatNameString(guidFormat); if (ret != 1) { return(0); } for (int i = 0; i < comboBoxCtrl.Items.Count; i++) { string itemText = comboBoxCtrl.GetItemText(comboBoxCtrl.Items[i]); if (itemText.Length > 0) { if (itemText == FormatName) { comboBoxCtrl.SelectedIndex = i; return(1); } } } return(0); }