private void medicalSchoolsToolStripMenuItem_Click(object sender, EventArgs e) { //Instance of frmMedicalSchoolList frmMedicalSchoolList MedicalSchoolForm = new frmMedicalSchoolList(); //make its parent of this parent MedicalSchoolForm.MdiParent = this; //display the form MedicalSchoolForm.Show(); }
private void btnMedicalShoolLookup_Click(object sender, EventArgs e) { //creat an instance of frmMedicalSchoolList frmMedicalSchoolList MedicalSchoolLookup = new frmMedicalSchoolList(); //make the MDI parent of this form the MDI parent of MedicalSchoolLookup form MedicalSchoolLookup.MdiParent = this.MdiParent; //Open the form MedicalSchoolLookup.Show(); }
private void btnSelectfromMedList_Click(object sender, EventArgs e) { //create an instance of the frmMedicalSchoolList frmMedicalSchoolList MedicalSchoolListForm = new frmMedicalSchoolList(); //make the MDI parent of the form be this MDI parent form MedicalSchoolListForm.MdiParent = this.MdiParent; //(Note:concept of delegates (an event handler is a delegate) means we can //pass the method getMedicalSchoolSelectedFromList to the MedicalSchoolListForm object. Because they both have the same signature //the getGPSelected method can call that method MedicalSchoolListForm.MedicalSchoolSelectedFromList += new EventHandler(getMedicalSchoolSelectedFromList); //display the MedicalSchoolListForm MedicalSchoolListForm.Show(); }
private void getMedicalSchoolSelectedFromList(object sender, EventArgs e) { //When the Child MedicalSchools List form has a MedicalSchool selected this will get the MedicalSchool number. //Declare a string variable to store the MedicalSchoolNumberSelected string MedicalSchoolNumberSelected; //We need an instance of the frmGPList that will be used to send us the information we need frmMedicalSchoolList MedicalSchoolListChildForm = sender as frmMedicalSchoolList; //if MedicalSchoolListChildForm is not empty i.e. list is populated if (MedicalSchoolListChildForm != null) { //get the MedicalSchool number from the MedicalSchool list using the getMedicalSchoolNumber() function MedicalSchoolNumberSelected = MedicalSchoolListChildForm.getMedicalSchoolNumber(); //put the Selected GP number in the textbox on this form this.txtMedicalSchoolCode.Text = MedicalSchoolNumberSelected; } }