Пример #1
0
        // provides for alteration of existing entry***********************************************

        private void updateButton_Click(object sender, EventArgs e)
        {
            // update the child form's table by deleting the original record and adding
            // the updated record

            child.getDelete(idx);

            if (child != null)
            {
                child.getUpdate(this.idRichTextBox.Text + "\t" + this.nameRichTextBox.Text + "\t" +
                                this.qtyReqRichTextBox.Text + "\t" + this.qtyRichTextBox.Text + "\t"
                                + this.practiceRichTextBox.Text);
            }

            this.Close(); // CLOSE AFTER EACH UPDATE TO AVOID ERROR-CAUSING CIRCUMSTANCES
        }
Пример #2
0
        // for deleting entries********************************************************************

        private void editMenuDelete_Click(object sender, EventArgs e)
        {
            // identify the active child form
            PracticeForm child = this.ActiveMdiChild as PracticeForm;

            // verify user's intent
            DialogResult waitAminute = MessageBox.Show("Delete the selected record?",
                                                       "CONFIRM DELETION", MessageBoxButtons.YesNo);

            if (waitAminute == DialogResult.Yes)
            {
                // get the index of the selected record from the form
                int idx = child.inventoryListBx.SelectedIndex;

                // delete the selected line from the child's list box
                child.getDelete(idx);
            }
            else // don't want to delete
            {
                // no action necessary
            }
        }