private void inkAddRental_MouseClick(object sender, MouseEventArgs e) { // Create a new instance of frmRental frmRental frm = new frmRental(); // Show the form // If the form returns DialogResult OK // Populate the DataGridView if (frm.ShowDialog() == DialogResult.OK) { PopulateGrid(); } }
private void DgvRentals_DoubleClick(object sender, EventArgs e) { // Check if a cell has been selected in the DataGridView // If not then stop the method if (dgvRentals.CurrentCell == null) { return; } // Create and assign the DataGridView Primary Key long pkID = long.Parse(dgvRentals[0, dgvRentals.CurrentCell.RowIndex].Value.ToString()); // Create a new instance of frmRental (with the Primary Key) frmRental frm = new frmRental(pkID); // Show the form // If the form returns DialogResult OK // Populate the DataGridView if (frm.ShowDialog() == DialogResult.OK) { PopulateGrid(); } }