public void Vendors() { Vendors vendor = new Vendors(); DataTable _vendorsDT = vendor.SelectAllVendords(); DataRow _row = _vendorsDT.NewRow(); _row[0] = 0; _row[1] = "Select Vendors"; _vendorsDT.Rows.InsertAt(_row, 0); metroComboBox1.DisplayMember = _vendorsDT.Columns[1].ToString(); metroComboBox1.ValueMember = _vendorsDT.Columns[0].ToString(); metroComboBox1.DataSource = _vendorsDT; metroComboBox1.SelectedIndex = 0; }
private void GetVendors() { Vendors vendorObj = new Vendors(); this._dt = vendorObj.SelectAllVendords(); DataRow row = this._dt.NewRow(); row[0] = 0; row[1] = "Select Vendor"; this._dt.Rows.InsertAt(row, 0); this.metroComboBox1.DisplayMember = this._dt.Columns[1].ToString(); this.metroComboBox1.ValueMember = this._dt.Columns[0].ToString(); this.metroComboBox1.DataSource = this._dt; this.metroComboBox1.SelectedIndex = 0; }
public void Vendors() { try { _dt_vendor = vendors.SelectAllVendords(); cb_vendors.DisplayMember = _dt_vendor.Columns[1].ToString(); cb_vendors.ValueMember = _dt_vendor.Columns[0].ToString(); cb_vendors.DataSource = _dt_vendor; DataRow row = _dt_vendor.NewRow(); row[0] = 0; row[1] = "Select Vendor"; _dt_vendor.Rows.InsertAt(row, 0); cb_vendors.SelectedIndex = 0; } catch (Exception ex) { } }
public void vendors() { try { Vendors vendor = new Vendors(); DataTable dt = vendor.SelectAllVendords(); metroComboBox1.DisplayMember = dt.Columns[1].ToString(); metroComboBox1.ValueMember = dt.Columns[0].ToString(); metroComboBox1.DataSource = dt; DataRow row = dt.NewRow(); row[0] = 0; row[1] = "Select Vendor"; dt.Rows.InsertAt(row, 0); metroComboBox1.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(ex.Message); } }