private void TelephoneTB_Validating(object sender, CancelEventArgs e) { string tel = TelephoneTB.Text.Trim(); if (string.IsNullOrEmpty(tel) || TelephoneTB.TextLength != 10) { TelephoneErr.SetError(TelephoneTB, "The telephone number must have 10 characters."); e.Cancel = true; } }
private void TelephoneTB_Validated(object sender, EventArgs e) { TelephoneErr.Clear(); }