private void btnRemove_Click(object sender, EventArgs e) { try { if (CC.CheckConnection() == false) { throw new Exception(); } try { DialogResult dRes = MessageBox.Show("Are you sure you want to delete Booking ID " + CC.BookingIntSpawner(libBookingID.SelectedItem.ToString()) + "?", "Attention!", MessageBoxButtons.YesNo); if (dRes == DialogResult.Yes) { string BookingID = CC.BookingIntSpawner(libBookingID.SelectedItem.ToString()); int bookingIDSelected = Convert.ToInt32(BookingID); CC.RemoveBooking(bookingIDSelected); MessageBox.Show("Booking removed: Booking ID:" + bookingIDSelected); libBookingID.Items.Clear(); } else { } } catch (Exception) { MessageBox.Show("Error: Booking not removed"); } } catch (Exception ) { MessageBox.Show("Connection error"); } }