Пример #1
0
        private void PopulateBookList()
        {
            //Populate the allBooks list of books from the database
            List <Book> allBooks = BookDB.GetAllBooks();

            //Start with an empty list, so it doesn't re-add previous books causing duplicates
            bookComboBox.Items.Clear();

            //Adds all of the books from the database in the bookComboBox
            foreach (Book b in allBooks)
            {
                bookComboBox.Items.Add(b);
            }
        }
Пример #2
0
 private void PopulateBookList()
 {
     cboBook.Items.Clear();
     try
     {
         List <Book> books = BookDB.GetAllBooks();
         foreach (Book b in books)
         {
             cboBook.Items.Add(b);
         }
     }
     catch (SqlException sqlex)
     {
         MessageBox.Show("We are having trouble loading book data at this time, please try again later.");
         Application.Exit();
     }
 }