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