Quote Originally Posted by mark-totnes View Post
I know this thread is old however I've just come across it with a Google search, so thought i'd post this if anybody else does...

I believe the simplest way to disallow characters is to use the Textbox.KeyPress event.
The below snippet handles disallowed characters AND maximum number of lines if you have a Multiline Textbox:

Code:
    Private Sub txtAddress_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtAddress.KeyPress
        'Below Handles Disallowed Characters
        Dim DisallowedCharacters As String = "'~`{}^¨|°¬+-[]^¨"
        If InStr(DisallowedCharacters, e.KeyChar) > 0 Then
            e.Handled = True
        End If

        'Below Handles max number of lines for multiline Textbox
        If txtAddress.Lines.Length >= 6 AndAlso e.KeyChar = ControlChars.Cr Then
            e.Handled = True
        End If

    End Sub

Do you know how to update this to wear it uses 'IsNumeric'?