Пример #1
0
        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();
            }
        }
Пример #2
0
        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();
            }
        }