If you place your code in the textbox validating event and then set the CausesValidation property of the button to false then the validating event for the textbox should not even be fired when the button is clicked.
If you do need to check for the tab key it is available in the KeyData property:
You can check for the tab key pressed in KeyData as follows:
method-id Form1_PreviewKeyDown final private.
procedure division using by value sender as object e as type System.Windows.Forms.PreviewKeyDownEventArgs.
if e::KeyData = type Keys::Tab
set tabwaspressed to true
else
set tabwaspressed to false
end-if
end method.