Example #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //declare a variable to store the GP number from the list box
            Int32 GPNo;

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

                //Create an instance of the frmGPDataEntry
                frmGPDataEntry GPEntryForm = new frmGPDataEntry();
                //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
                GPEntryForm.MdiParent = this.MdiParent;
                //display the GPEntry form
                GPEntryForm.Show();
                //invoke the findGP method (that we created in frmGPDataEntry)
                GPEntryForm.FindGP(GPNo);//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);
            }
        }
        private void gPDataEntryToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            //Instance of frmGPDataEntry
            frmGPDataEntry GPDataEntryForm = new frmGPDataEntry();

            //make its parent of this parent
            GPDataEntryForm.MdiParent = this;
            //display the form
            GPDataEntryForm.Show();
        }
Example #3
0
        private void btnGPDataEntry_Click(object sender, EventArgs e)
        {
            //creat an instance of frmGPDataEntry
            frmGPDataEntry GPDataEntryForm = new frmGPDataEntry();

            //make the MDI parent of this form the MDI parent of GPDataEntryForm
            GPDataEntryForm.MdiParent = this.MdiParent;
            //Open the form
            GPDataEntryForm.Show();
        }
Example #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //create an instance of frmGPDataEntry
            frmGPDataEntry GPEntryForm = new frmGPDataEntry();

            //make the form a child of the mdi parent
            GPEntryForm.MdiParent = this.MdiParent;
            //display the GP Entry form
            GPEntryForm.Show();
            //invoke the AddNewGP method (in frmGPDataEntry)
            GPEntryForm.AddNewGP(); //prepares the form for data entry
        }