コード例 #1
0
        private void inkAddTool_Click(object sender, EventArgs e)
        {
            // Initialize a new frmTool
            frmTool frm = new frmTool();

            // Show the new form
            // If the form returns the DialogResult OK
            // Populate the DataGridView
            if (frm.ShowDialog() == DialogResult.OK)
            {
                PopulateGrid();
            }
        }
コード例 #2
0
        private void dgvTools_DoubleClick(object sender, EventArgs e)
        {
            // Check if a cell has been selected in the DataGridView
            // If not stop the method
            if (dgvTools.CurrentCell == null)
            {
                return;
            }

            // Create and assign the primary key of the DataGridView
            long pkID = long.Parse(dgvTools[0, dgvTools.CurrentCell.RowIndex].Value.ToString());

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

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