//An action handler that search and retrieves the author name along with the book from the inventories private void btnSearchAuthor_Click(object sender, EventArgs e) { InventoryItems itemFound = inventories.searchAuthor(txtAuthorSearch.Text); if (txtAuthorSearch.Text == "") { MessageBox.Show("You haven't added any inventories, os you can't search anything", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (itemFound == null && txtAuthorSearch.Text != null) { MessageBox.Show(txtAuthorSearch.Text + " is not in inventory", "Search Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } 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("************************************"); } txtAuthorSearch.Clear(); txtAuthorSearch.Focus(); }