ComboUtils.FillComboBox(cmbSubRegister, RGMaster.GetRegisterByParentID(Convert.ToInt32(cmbRegister.SelectedValue), false), true, "RegisterName", "RegisterID");
public static void FillComboBox(ComboBox cmb, object obj, bool valFieldRequired, string dispField, string valField) { if (obj.GetType().ToString() == "System.Data.DataSet") { cmb.DisplayMember = dispField; if (valFieldRequired) cmb.ValueMember = valField; cmb.DataSource = ((DataSet)obj).Tables[0]; }