public static void fillTaxCodeCombo(System.Windows.Forms.ComboBox cmb) { cmb.Items.Clear(); try { TaxCodeDB tcdb = new TaxCodeDB(); List <taxcode> TaxCodes = tcdb.getTaxCode(); foreach (taxcode tc in TaxCodes) { cmb.Items.Add(tc.TaxCode); } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static void fillTaxCodeGridViewCombo(DataGridViewComboBoxCell cmb, string CategoryName) { cmb.Items.Clear(); try { TaxCodeDB tcdb = new TaxCodeDB(); List <taxcode> TaxCodes = tcdb.getTaxCode(); foreach (taxcode tc in TaxCodes) { if (tc.status == 1) { Structures.GridViewComboBoxItem ch = new Structures.GridViewComboBoxItem(tc.Description, tc.TaxCode); cmb.Items.Add(ch); } } cmb.DisplayMember = "Name"; // Name Property will show(Editing) cmb.ValueMember = "Value"; // Value Property will save(Saving) } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }