Пример #1
0
        //validate and output result
        private void buttonCheckDate_Click(object sender, EventArgs e)
        {
            bool validDate = DateValidator.Validate(textBoxYear.Text, textBoxMonth.Text, textBoxDay.Text);

            if (validDate)
            {
                labelOutput.ForeColor = Color.Green;
                labelOutput.Text      = "Valid";
                toolTipOnMainForm.SetToolTip(labelOutput, "Entered Date is Valid");
            }
            else
            {
                labelOutput.ForeColor = Color.Red;
                labelOutput.Text      = "Invalid";
                toolTipOnMainForm.SetToolTip(labelOutput, "Entered Date is NOT Valid");
            }
        }
Пример #2
0
        private void checkDateButton_Click(object sender, EventArgs e)
        {
            bool isValid = DateValidator.Validate(textBoxYear.Text, textBoxMonth.Text, textBoxDay.Text);

            if (isValid)
            {
                labelResult.ForeColor = Color.Green;
                labelResult.Text      = "Valid";
                toolTipResult.SetToolTip(labelResult, "Entered Date is Valid");
            }
            else
            {
                labelResult.ForeColor = Color.Red;
                labelResult.Text      = "Invalid";
                toolTipResult.SetToolTip(labelResult, "Entered Date is NOT Valid");
            }
        }
 /// <summary>
 /// Method that confirms a valid or invalid date when
 /// buttonCheckDate is clicked
 /// </summary>
 /// <param name="sender">the control/object to set</param>
 /// <param name="e">the event data to set</param>
 private void buttonCheckDate_Click(object sender, EventArgs e)
 {
     dateValidation(DateValidator.Validate(textBoxYear.Text, textBoxMonth.Text, textBoxDay.Text));
 }