private void button1_Click(object sender, EventArgs e)
        {
            App_Data.PisDataSetTableAdapters.PatientsTableAdapter myPatAd = new App_Data.PisDataSetTableAdapters.PatientsTableAdapter();
            App_Data.PisDataSet.PatientsDataTable myPatTable = new App_Data.PisDataSet.PatientsDataTable();

            App_Data.PisDataSetTableAdapters.ImagesTableAdapter myImgAd = new App_Data.PisDataSetTableAdapters.ImagesTableAdapter();
            App_Data.PisDataSet.ImagesDataTable myImgtbl = new App_Data.PisDataSet.ImagesDataTable();

            if (publicClass.IsModification)
            {
                try
                {
                    if (txtImageLocation.Text != "" && cmbImageIndex.SelectedIndex != -1)
                    {
                        myImgAd.UpdateImageLocationQuery(txtImageLocation.Text, Convert.ToInt32(cmbImageID.Items[cmbImageIndex.SelectedIndex]));
                    }
                    myPatAd.UpdatePatientQuery(txtpatientName.Text,
                                        txtAge.Text,
                                        Convert.ToDateTime(Convert.ToDateTime(txtDate.Text).ToShortDateString()),
                                        txtMobileNo.Text,
                                        txtLandLine.Text,
                                        txtDoctorName.Text,
                                        txtAddress.Text,
                                        txtComplaint.Text,
                                        txtFindings.Text,
                                        publicClass.PatientID);
                    MessageBox.Show("Updated Successfully");
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Update Error! " + exc.Message);
                }
            }
            else
            {
                try
                {

                    txtImageLocation.Width = 193;
                    myImgAd.InsertImageQuery(txtImageLocation.Text, publicClass.PatientID);
                    myPatAd.InsertQuery(txtpatientName.Text,
                                        Convert.ToInt32(txtAge.Text).ToString(),
                                        Convert.ToDateTime(Convert.ToDateTime(txtDate.Text).ToShortDateString()),
                                        txtMobileNo.Text,
                                        txtLandLine.Text,
                                        txtDoctorName.Text,
                                        txtAddress.Text,
                                        txtComplaint.Text,
                                        txtFindings.Text);
                    MessageBox.Show("Record Added!");
                }
                catch (Exception exc)
                {
                    MessageBox.Show("Add Error!! " + exc.Message);
                }
            }
        }
        private void button1_Click_2(object sender, EventArgs e)
        {
            try
            {
                if (txtImageLocation.Text == "")
                {
                    MessageBox.Show("Image Location Can't Be Null");
                    return;
                }
                else if (txtImageLocation.Text != "")
                {
                    App_Data.PisDataSetTableAdapters.ImagesTableAdapter myAd = new App_Data.PisDataSetTableAdapters.ImagesTableAdapter();
                    App_Data.PisDataSet.ImagesDataTable myTbl = new App_Data.PisDataSet.ImagesDataTable();

                    myAd.InsertImageQuery(txtImageLocation.Text, publicClass.PatientID);
                    myAd.FillImagesbyPatientBy(myTbl, Classes.publicClass.PatientID);
                    cmbImageID.Items.Clear();
                    cmbImageIndex.Items.Clear();
                    for (int index = 0; index < myTbl.Rows.Count; index++)
                    {
                        cmbImageIndex.Items.Add((index + 1).ToString());
                        cmbImageID.Items.Add(myTbl.Rows[index]["ImageID"].ToString());
                    }

                  txtImageLocation.Text = "";
                  cmbImageIndex.SelectedIndex = -1;
                  cmbImageIndex.Text = "";
                    MessageBox.Show("New Image Loaded!");
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }