You probably want to use the following in the keydown event of the textbox:
If
e.KeyCode = Keys.Enter Then 'your code here e.SuppressKeyPress = TrueThat last line to suppress the key from going to the KeyPress event. If you rather add the code to the KeyPress event, you should use: