//refactored private void LoadProducts() { try { ProductBindingSource.DataSource = dataAccess.LoadProducts(); } finally { ProductBindingSource.ResetBindings(false); } }
private void AddProduct_Click(object sender, EventArgs e) { if (dgvProducts.Rows.Count == 1) { EnableFields(); } add.Enabled = false; ProductBindingSource.AddNew(); //dgvProducts.DataSource = ProductBindingSource; dgvProducts.CurrentRow.Selected = true; code_.Focus(); }
private void ProductCancelButton_Click(object sender, EventArgs e) { ProductBindingSource.CancelEdit(); ShowDataGrid(ProductDataGridView, ProductAddButton, ProductPanel); }
private void ProductAddButton_Click(object sender, EventArgs e) { ProductBindingSource.AddNew(); HideDataGrid(ProductDataGridView, ProductAddButton, ProductPanel); }