private void bnListBooks_Click(object sender, EventArgs e) { // XXX List Books button event handler while (true) { try { // to capture an exception from SelectedItem/SelectedIndex of listBooksDialog listBooksDialog.ClearDisplayItems(); //listBooksDialog.AddDisplayItems(null); //null is a dummy argument BookShopControl.printBookToBookdialog(listBooksDialog); if (listBooksDialog.Display() == DialogReturn.Done) { return; } // select is pressed BookShopControl.editBookStaffView(bookDialog, listBooksDialog); while (true) { try { // to capture an exception from Price/Stock of bookDialog if (bookDialog.Display() == DialogReturn.Cancel) { break; } // XXX BookShopControl.updateBookInformationStaff(bookDialog, listBooksDialog); break; } catch (BookShopException bsex) { MessageBox.Show(this, bsex.ErrorMessage); continue; } } } catch (BookShopException bsex) { MessageBox.Show(this, bsex.ErrorMessage); continue; } } }