/********************************************************************** * EVENT HANDLER for the insert tab tha allows the user to insert a record * to the active Practice Form*/ private void insertToolStripMenuItem1_Click(object sender, EventArgs e) { PracticeForm P = this.ActiveMdiChild as PracticeForm; //there is an active child if (P != null) { records = P.getRecords(); insertForm I = new insertForm(records, P.getPracticeName()); I.ShowDialog(); P.refresh(records); MessageBox.Show("Record has been added to the inventory list.", "Done!"); } //there is not an active child else { MessageBox.Show("No Clinic form available.", "Error"); } }
/********************************************************************** * EVENT HANDLER that allows the user to delete a selected record from * the active practice form*/ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { PracticeForm P = this.ActiveMdiChild as PracticeForm; //there is an active child if (P != null) { records = P.getRecords(); //recieves the selected record int index = P.findIndex(); if (index > 1) { //removes it (but makes sure it isnt the header lines) records.RemoveAt(index - 2); P.refresh(records); MessageBox.Show("Record has been removed from inventory list.", "Done!"); } } //there is not an active child else { MessageBox.Show("No clinic form available.", "Error"); } }