//An action handler that search the book title added by the user to the inventoris private void btnBookTitleSearch_Click(object sender, EventArgs e) { InventoryItems itemFound = inventories.searchBookTitel(txtBookSearch.Text); if (txtBookSearch.Text == "") { MessageBox.Show("You haven't added anything, so you can't search anything", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (itemFound == null && txtBookSearch != null) { MessageBox.Show(txtBookSearch.Text + " is not in inventories", "Information", MessageBoxButtons.OK); } else { lstSearchItems.Items.Add(label2.Text + itemFound.getbookTitle()); lstSearchItems.Items.Add(label3.Text + itemFound.GetAuthorName()); lstSearchItems.Items.Add(label4.Text + itemFound.getPubisher()); lstSearchItems.Items.Add(""); lstSearchItems.Items.Add("**********************************"); } txtBookSearch.Clear(); txtBookSearch.Focus(); }