command = new SqlCommand(); adapter = new SqlDataAdapter(); dataset = new DataSet(); bindingSource = new BindingSource(); command.Connection = connection; command.CommandText = "SELECT * FROM customer"; adapter.SelectCommand = command; try { adapter.Fill(dataset, "customer"); bindingSource.DataSource = dataset; bindingSource.DataMember = "customer"; dgvCustomers.DataSource = bindingSource; txtCustNo.DataBindings.Add("Text", bindingSource.DataSource, "Customer.CustNo"); txtName.DataBindings.Add("Text", bindingSource.DataSource, "Customer.CustName"); txtEmail.DataBindings.Add("Text", bindingSource.DataSource, "Customer.email"); txtTelNo.DataBindings.Add("Text", bindingSource.DataSource, "Customer.TelNo"); cboGender.DataBindings.Add("Text", bindingSource.DataSource, "Customer.Gender"); cboTerms.DataBindings.Add("Text", bindingSource.DataSource, "Customer.PaymentTerm"); } catch (SqlException) { MessageBox.Show("Error occured while connecting to database."); Application.Exit(); }The data loads into the grid correctly. To get the textboxes to refresh when the row in the colum changes I use currency manager:
CurrencyManager cm = (CurrencyManager)this.BindingContext[dataset, "Customer"]; long rowPosition = (long)cm.Position; cm.Position = dgvCustomers.CurrentRow.Index;From what I have read using the currency manager like I have is an old method and I should use the internal currency manager of the bindingsouce. But I have not been able work out how.