I tried this simple code but how to set this for all textboxes in the form?
Private Sub textBox1_KeyPress(sender As Object, e As KeyPressEventArgs)
If e.KeyChar <> ControlChars.Back AndAlso e.KeyChar <> "-"C Then
e.Handled = Not Char.IsNumber(e.KeyChar)
If Not e.Handled Then
Dim num As Integer = Integer.Parse(String.Format("{0}{1}", If(textBox1.Text = String.Empty, "", textBox1.Text), e.KeyChar.ToString()))
If num > 11 Then
e.Handled = True
End If
End If
End If
End Sub