private void button1_Click(object sender, EventArgs e)
        {
            //declare a variable to store the MedicalCentres number from the list box
            Int32 MedicalCentreNo;

            //check to see if a record has been selected
            if (lstMedicalCentres.SelectedIndex != -1)
            {
                //get the selected value from the list which should contain the primary key
                MedicalCentreNo = Convert.ToInt32(lstMedicalCentres.SelectedValue);

                //Create an instance of the frmGPDataEntry
                frmMedicalCentreEntry MedicalCentreEntryForm = new frmMedicalCentreEntry();
                //make the form a child of the mdi parent
                //This line makes the form a child of the mdi parent of the current form.
                //This means that both forms share the same parent
                MedicalCentreEntryForm.MdiParent = this.MdiParent;
                //display the MedicalCentreEntry form
                MedicalCentreEntryForm.Show();
                //invoke the findMedicalCentre method (that we created in frmMedicalCentreDataEntry)
                MedicalCentreEntryForm.FindMedicalCentre(MedicalCentreNo);//Filter form for this GP no
            }
            else
            {
                //if nothing is selected on the list then display a message
                MessageBox.Show("Please select a GP from the list", "GPs List", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 2
0
        private void btnMedicalCentreDataEntry_Click(object sender, EventArgs e)
        {
            //creat an instance of frmMedicalCentreList
            frmMedicalCentreEntry MedicalCentreDataEntryForm = new frmMedicalCentreEntry();

            //make the MDI parent of this form the MDI parent of MedicalCentreDataEntryForm
            MedicalCentreDataEntryForm.MdiParent = this.MdiParent;
            //Open the form
            MedicalCentreDataEntryForm.Show();
        }