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