private void btnConfirm_Click(object sender, EventArgs e)
        {
            //declares 3 variables
            Int32 AgeMin;
            Int32 AgeMax;
            string Location;

            //this converts the two values to Int32 and gets the location txt box
            AgeMin = Convert.ToInt32(NumUpDwnAgeMin.Value);
            AgeMax = Convert.ToInt32(NumUpDownAgeMax.Value);
            Location = txtBxLocation.Text;



            //these are some simple validation techniques, before the full ones are implemented in the main model
            if (Location == "")
            {
                lblError.Text = "Please enter a location";
            }

            else if (AgeMax < AgeMin)
            {
                lblError.Text = "The minimum age must be less than or equal to the maximum age";
            }

            //this runs if all the validation runs ok
            //this also runs if the user is editing a current saved search
            else
            {
                    FrmEmailClient EmailClient = new FrmEmailClient();
                    clsCustomerSavedSearch SavedSearch = new clsCustomerSavedSearch();
                    SavedSearch.AddNewSavedSearch(AgeMin, AgeMax, Location);
                    //this runs if it's an edit rather than a new email
                    if (OldMinAge != 0)
                    {
                        clsCustomerSavedSearch SavedSearch2 = new clsCustomerSavedSearch();
                        SavedSearch2.RemoveItem(OldMinAge, OldMaxAge, OldLocation);
                    }
                    EmailClient.Show();
                    this.Close();
            }
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //this checks to see if the user has selected an item from the listbox, as the default value is -1
            if (LstBxSavedSearch.SelectedIndex > -1)
            {
                if (MessageBox.Show("Are you sure you want to delete this saved search?", "Confirm Deletion", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    //this gets the list result from the lisbox saved search
                    string ListResult = LstBxSavedSearch.SelectedItem.ToString();
                    //this gets the integer AgeFrom from the listresult
                    Int32 AgeFrom = Convert.ToInt32(ListResult.Substring(7, 2));
                    //this gets the integer AgeTo from the ListResult
                    Int32 AgeTo = Convert.ToInt32(ListResult.Substring(10, 2));
                    //this gets the location from the ListResult
                    string Location = ListResult.Substring(22);

                    //new clsCustomerSavedSearch instance of the class
                    clsCustomerSavedSearch SavedSearch = new clsCustomerSavedSearch();
                    //call the removeItem method passing parameters
                    SavedSearch.RemoveItem(AgeFrom, AgeTo, Location);
                    //initalise the form ready for the refresh
                    FrmEmailClient EmailClient = new FrmEmailClient();
                    //close the current form
                    this.Close();
                    //call the same form again.
                    EmailClient.Show();

                }
 
            }
            else
            {
                //this gives us an error message as nothing as been selected
                lblError.Text = "Please Select an item to delete from the listbox";
            }

        }