Exemple #1
0
        private void title_Validating(object sender, CancelEventArgs e)
        {
            if (BookPropertyValidator.ValidateAuthor(titleTextBox.Text))
            {
                e.Cancel = false;

                if (!String.IsNullOrWhiteSpace(titleTextBox.Text))
                {
                    titleTextBox.BackColor = Color.FromArgb(154, 208, 208);
                }
            }

            else
            {
                e.Cancel = true;
                titleTextBox.BackColor = Color.FromArgb(214, 140, 140);
                MessageBox.Show("Invalid title.\nSample: Midnight Rain");
                invalidTitleLabel.Visible = true;
            }
        }
Exemple #2
0
        private void genre_Validating(object sender, CancelEventArgs e)
        {
            if (BookPropertyValidator.ValidateAuthor(genreTextBox.Text))
            {
                e.Cancel = false;

                if (!String.IsNullOrWhiteSpace(genreTextBox.Text))
                {
                    genreTextBox.BackColor = Color.FromArgb(154, 208, 208);
                }
            }

            else
            {
                e.Cancel = true;
                genreTextBox.BackColor = Color.FromArgb(214, 140, 140);
                MessageBox.Show("Invalid genre.\nSample: Fantasy");
                invaledGenreLabel.Visible = true;
            }
        }
Exemple #3
0
        private void author_Validating(object sender, CancelEventArgs e)
        {
            if (BookPropertyValidator.ValidateAuthor(authorTextBox.Text))
            {
                e.Cancel = false;

                if (!String.IsNullOrWhiteSpace(authorTextBox.Text))
                {
                    authorTextBox.BackColor = Color.FromArgb(154, 208, 208);
                }
            }

            else
            {
                e.Cancel = true;
                authorTextBox.BackColor = Color.FromArgb(214, 140, 140);
                MessageBox.Show("Invalid author.\nSample: Surname, Forename\nRalls, Kim");
                invalidAuthorLabel.Visible = true;
                authorSampleLabel.Visible  = true;
            }
        }