Sometimes, UI designs demand text boxen to accept only numeric data(aka no characters) - after all, entering abc as a delay time value most definitely won’t make much sense. While the Palm OS allows developers to create so-called “numeric text fields” that only accept numbers, the .NET CF does not include this feature…

The code below restricts user input to the characters 1234567890 - no decimal points/commas can be entered:

Private Sub TxtX_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtX.KeyPress, TxtY.KeyPress
e.Handled = True
If Char.IsNumber(e.KeyChar.ToString) Then
e.Handled = False
End If
End Sub

Just paste it into the form’s code, and add the names of all numeric text boxen instead of TxtX and TxtY(you can have 1 to n).

Enjoy your numeric text box…