A have a simple textbox and I await a Delay Task inside a Validating handler. The Validated handler is always called, independently of whether I have e.Cancel = true
or not! Note that if I omit the await call, validation occurs as expected. Why does this happen?
private async void textBox1_Validating(object sender, CancelEventArgs e)
{
await Task.Delay(2000);
e.Cancel = true;
}
private void textBox1_Validated(object sender, EventArgs e)
{
MessageBox.Show("THIS WILL ALWAYS BE CALLED!");
}