private void BirthdayPicker_Leave(object sender, System.EventArgs e) { String input = BirthdayPicker.Text.ToString(); DateTime inputDate; DateTime now = DateTime.Today; if (DateTime.TryParse(input, out inputDate)) { int result = DateTime.Compare(inputDate, now); if (result > 0) { BirthdaywarningLabel.Show(); } BirthdaywarningLabel.Hide(); String bdayPart = inputDate.ToString("dd/MM/yyyy").Replace(".", ""); bdayPart = bdayPart.Remove(4, 2); SSNBox.Text = bdayPart + "-"; SSNBox.Focus(); } else { BirthdaywarningLabel.Show(); } }
private void CancelButton_Click(object sender, EventArgs e) { NameBox.Text = ""; SurnameBox.Text = ""; FullNameShow.Text = ""; FullNameShow.Hide(); PasswordBox.Text = ""; RepeatPasswordBox.Text = ""; BirthdayPicker.Value.ToLocalTime(); SSNBox.Text = ""; EmailBox.Text = ""; CodeBox.Text = ""; NamewarningLabel.Hide(); SurnamewarningLabel.Hide(); BirthdaywarningLabel.Hide(); PassWarningLabel.Hide(); PassRepeatWarningLabel.Hide(); SSNwarningLabel.Hide(); EmailWarningLabel.Hide(); NameBox.Focus(); }