There is a much simpler way to do this:
public const string HexLetters = "0123456789abcdefABCDEF\b";
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (! HexLetters.Contains(e.KeyChar)) e.Handled = true;
}
The KeyPress EventHandler is fired after the KeyDown Event, and gives us an easy way to get the character of the key that was pressed.
If the current character is not in the set of characters we want to allow, then setting e.Handled = true; in the KeyPress EventHandler will stop the current character from being "passed on" to other possible subscribers.