private void btnEdit_Click(object sender, EventArgs e) { if (productGridView.SelectedRows.Count > 0) { DataGridViewRow dataRow = productGridView.SelectedRows[0]; int.TryParse(dataRow.Cells["id"].Value.ToString(), out int id); if (id < 0) { return; } var frmProductAdd = new frmProductAdd(this, userId, id); frmProductAdd.ShowDialog(); } else { MessageBox.Show("Please select a brand to update"); } }
private void dataRowDouble_Click(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } var dataRow = productGridView.Rows[e.RowIndex]; int.TryParse(dataRow.Cells["id"].Value.ToString(), out int id); if (id < 0) { return; } var frmProductAdd = new frmProductAdd(this, userId, id); frmProductAdd.ShowDialog(); }
private void btnAdd_Click(object sender, EventArgs e) { var frmProductAdd = new frmProductAdd(this, userId); frmProductAdd.ShowDialog(); }