Example #1
0
        private void BtnInsertItem_Click(object sender, EventArgs e)
        {
            // Create a new instance of frmRentalItem (with the RentalID)
            frmRentalItem frm = new frmRentalItem(txtRentalD.Text);

            // Show the form
            // If the form returns DialogResult OK
            // Populate the DataGridView
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PopulateGrid();
            }
        }
Example #2
0
        private void DgvRentalItems_DoubleClick(object sender, EventArgs e)
        {
            // Check if a cell has been selected in the DataGridView
            // Stop the method
            if (dgvRentalItems.CurrentCell == null)
            {
                return;
            }

            // Create and assign the DataGridView Primary Key
            long pkID = long.Parse(dgvRentalItems[0, dgvRentalItems.CurrentCell.RowIndex].Value.ToString());

            // Create a new instance of frmRentalItem (with the Primary Key)
            frmRentalItem frm = new frmRentalItem(pkID);

            // Show the form
            // If the form returns the DialogResult OK
            // Populate the DataGridView
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PopulateGrid();
            }
        }