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