//############### ADDING ###############
 private void btnAdd_Click(object sender, EventArgs e)
 {
     frmAddNew newPatentForm = new frmAddNew();
     Patent patent = newPatentForm.GetNewPatent();
     if (patent != null)
     {
         int key = newPatentForm.GetNewKey();
         patents.Add(key, patent);
         PatentDB.SavePatents(patents);
         FillPatentListView();
     }
     btnEdit.Enabled = false;
 }
        //############### SEARCHING ###############
        private void btnSearch_Click(object sender, EventArgs e)
        {
            frmSearch searchForm = new frmSearch();
            string searchString = searchForm.GetSearchString();
            int searchKey = 0;

            if (Int32.TryParse(searchString, out searchKey)) //if there was input in the search form
            {
                if (patents.ContainsKey(searchKey))
                {
                    //get select patent using the key
                    Patent searchPatent = patents[searchKey];

                    lvPatents.Items.Clear(); //clear listview

                    AddSearchPatentToListView(searchPatent);
                }
                else
                {
                    DialogResult result = MessageBox.Show("No records exist for that patent. \nPress 'OK' to add a record.",
                            "No Record Found", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                    if (result == DialogResult.OK)
                    {
                        frmAddNew newPatentForm = new frmAddNew();
                        newPatentForm.SearchKey = searchKey;
                        Patent patent = newPatentForm.GetNewPatent();

                        if (patent != null)
                        {
                            int key = newPatentForm.GetNewKey();
                            patents.Add(key, patent);
                            PatentDB.SavePatents(patents);
                            FillPatentListView();
                        }
                    }
                }
                btnEdit.Enabled = false;
            }
        }