private void TxtEndDate_Validating(object sender, CancelEventArgs e) { if (_Tag == "" || ActiveControl == TxtEndDate) { return; } if (TxtEndDate.Text != " / /") { try { if (ClsGlobal.CheckDateInsideCompanyPeriod(Convert.ToDateTime(TxtEndDate.Text)) == 1) { ClsGlobal.DateRangeMsg(); TxtEndDate.Focus(); } } catch { MessageBox.Show("Please enter valid date.", "Mr. Solutions", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtEndDate.Focus(); } } else { ClsGlobal.DateRangeMsg(); TxtEndDate.Focus(); } }