Public Class Form1 Public Sub New() InitializeComponent() End Sub Public Sub Form1_Load(Byval sender As Object, Byval e As EventArgs) Handles Form1.Load Me.KeyPreview = True End Sub Private Sub TextBox1_KeyPress(Byval sender As Object, Byval e As KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then MessageBox.Show("Enter is pressed.") End If End Sub End Class