Use the Validating event of TextBox.
It checks if your validation condition is met before leaving the control. For example
private void textBox1_Validating(object sender, CancelEventArgs e)
{
if (textBox1.Text == "hello")
e.Cancel = true;
}
If the user types 'hello' in textBox1, the AcceptButton click event is not raised and this way, you don't have to change anything. Just change the validation in the KeyDown event to the Validating event.