WackoWolf
Active member
I understand the code as to what it does, and I also understand why I want it. The problem I have is where do I put it. Do I put it in the button for the calculation or somewhere else? This is the code I want to use.
VB.NET:
Private Sub txt""_KeyPress (ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventsArgs) Handles txt"".KeyPress
Const Enter = Chr(13)
If e.KeyChar = ENTER Then
btnCalculate.Focus()
ElseIf Asc(e.KeyChar) < Asc("0") Or Asc(e.KeyChar) > Asc("9") Then e.Handled = True
Beep()
MessageBox>Show ("You can only enter a number here.", "Data Entry Error". MessageBoxButtons.Ok, MessageBoxIcon.Error)
End If
End Sub