Пример #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //Create an instance of frmConsultantEntry
            frmConsultantsEntry Consultant = new frmConsultantsEntry();
            //declare a variable to store the abhMedicalCentreNo from the list box
            int abh_MedicalCentreNo;

            //check to see if a record has been selected
            if (lstBoxes.SelectedIndex != -1)
            {
                //get the selected value from the list which should contain the primary key
                abh_MedicalCentreNo = Convert.ToInt32(lstBoxes.SelectedValue);
                //make the form a child of mdi parent
                Consultant.MdiParent = this.MdiParent;
                //display the Consultants entry form
                Consultant.Show();
                //invoke the findCentre method (that we created in frmConsultantEntry)
                Consultant.FindCentre(abh_MedicalCentreNo);//Filters form for this MedicalCentreNo
            }

            else
            {
                //if nothing is selected on the list then display a message
                MessageBox.Show("Please select a medical centre form the list", "abh_MedicalCentreNo",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //create an instance of frmConsultantsEntry
            frmConsultantsEntry Medical = new frmConsultantsEntry();

            //make the form a child of the mdi parent
            Medical.MdiParent = this.MdiParent;
            //display the Medical entry form
            Medical.Show();
            //invoke the AddNewMedical method (that we create in frmConsultantsEntry)
            Medical.AddNewMedical();//Sets form ready for new Medical entry
        }