Public Class frm1
  Private Sub txtInput_KeyPress(KeyCode As Integer)
If KeyCode = 13 Then 
YourVariable = txtInput.Text
End If
End Sub
 
 
End Class