// DELETE FROM INVENTORY BUTTON click event private void btn_DeleteFromInventory_Click(object sender, EventArgs e) { // Verify that user selected an inventory item in the search result combobox if (cbx_ResultsList.SelectedItem == null) { MessageBox.Show("No Inventory Item Selected. Please select an inventory item from the drop-down list and try again", "Invalid Status Change", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } // Verify that the item is in SOLD status...any other status can't be marked as DELIVERED else if (inventoryItems[cbx_ResultsList.SelectedIndex].InventoryItemStatus != InventoryItemStatus.Sold) { MessageBox.Show("You can only deliver an item that is currently in 'Sold' status. Please try again", "Invalid Item Status", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } // If user input appears to be valid, continue else { // Delete inventory item from database ApplicationObjects.RemoveInventoryItemFromInventory(inventoryItems[cbx_ResultsList.SelectedIndex]); // Clear all fields to prepare for next search. ResetInventorySearch(); } }