How to limit the characters that can be entered into a Text Box ? Vb.Net Code for beginers

There is very simple code for restricting  the letter entry in a text box and that code can be write on the keypress of that particular textbox in which you want to restrict the entry
 the code will be
  Private Sub TxtPisno_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtPisno.KeyPress

        Dim validchar As String
        validchar = "0123456789"
        If Asc(e.KeyChar) >= 32 Then
            If InStr(validchar, e.KeyChar) = 0 Then
                e.Handled = True
            End If
        End If
    End Sub
In the above code only number 0 to 9 are allow to be enter in the text box so if you want allow other letter to enter in text box just put that letters in place of
these numbers.

To understand Vb.Net in better way I will suggest you to have  book written by Anne Prince  "Murach Visual Basic" and that is available on  Amozon and Flipkart 
Hope it will help you.