protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (this.Text == "") { } else { if (DateTime.TryParseExact(this.Text, "dd/mm/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out DateTime theDate)) { } else { MessageBox.Show("Invalid Date : Date should be in 'DD/MM/YYYY' format"); this.Focus; } } }
this.Focus();
Focus
Control
using System.Drawing;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)