private void buyButton_Click(object sender, EventArgs e) { // Hide message messageLabel.Hide(); try { Product product = (Product)shopListBox.SelectedValue; if (product == null) { messageLabel.Text = "No product selected!"; messageLabel.Show(); return; } // Buy product messageLabel.Text = client.Buy(product, customer); messageLabel.Show(); } catch (Exception exception) { System.Diagnostics.Debug.WriteLine(exception.Message); messageLabel.Text = "Oops! Something went wrong!"; } RefreshAll(); }