Beispiel #1
0
        private void publishdate_Validating(object sender, CancelEventArgs e)
        {
            if (BookPropertyValidator.ValidateDate(publishdateTextBox.Text))
            {
                e.Cancel = false;

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

            else
            {
                e.Cancel = true;
                publishdateTextBox.BackColor = Color.FromArgb(214, 140, 140);
                MessageBox.Show("Invalid publish date.\nSample: mm/dd/yy e.g. 12/30/2000");
                invalidPublishDateLabel.Visible = true;
            }
        }