As people have often mentioned, handling KeyPress event is not foolproof. Someone can copy-paste text into the textbox and this logic will fail.
I usually handle the Leave event.
TextBox_Leave()
{
// Validate input
}
I see two advantages:
1. The event is not triggered every time the user enters a character.
2. It works for any kind of input device - keyboard or mouse.
I see one major problem with this, though:
If your form has its AcceptButton set to any button, and the user presses "Enter" after entering some text into the TextBox, the Leave event is never triggered and the form is closed. Either you can disable the AcceptButton (if you have many text boxes to validate) or validate the text again in 'Form_Closing' event.
This solution has worked well for me until now.