private void CityTB_Validating(object sender, CancelEventArgs e) { string city = CityTB.Text.Trim(); if (string.IsNullOrEmpty(city)) { CityErr.SetError(CityTB, "You have to enter a city"); e.Cancel = true; } }
private void CityTB_Validated(object sender, EventArgs e) { CityErr.Clear(); }