Example #1
0
 // Another level of validation. No point in moving to the "Book fields"
 // if there is no ISBN
 private void BookFields_Enter(object sender, EventArgs e)
 {
     if (ValidateBook.ISBN(textBoxISBN.Text))
     {
         UpdateStatus("Please fill in a Title, Author, Rating & year published");
     }
     else
     {
         textBoxISBN.HighlightFocus();
         UpdateErrorStatus("Please supply a postive non-zero whole number ISBN first");
     }
 }
Example #2
0
        // Validate the textboxes. If validated, enable the respected buttons.
        private void ValidateBoxes(object sender, EventArgs e)
        {
            bool isbnValid = ValidateBook.ISBN(textBoxISBN.Text);

            buttonAddBook.Enabled = isbnValid &&
                                    ValidateBook.Title(textBoxTitle.Text) &&
                                    ValidateBook.Author(textBoxAuthor.Text) &&
                                    ValidateBook.Rating(textBoxRating.Text) &&
                                    ValidateBook.PubYear(textBoxPubYear.Text);

            // buttonGetAllISBN is enabled by Adding a book and disabled by
            // removing all books from the BST.
            buttonFindBook.Enabled   = isbnValid & books.HasEntries;
            buttonRemoveBook.Enabled = isbnValid & books.HasEntries;
        }