Insert Only Digits In TextBox

Posted by Satyapriyanayak under VB.NET category on | Points: 40 | Views : 1496
In this Code Snippet we will know how to insert Only Digits in a TextBox. 

Public Class Form1

Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Char.IsDigit(e.KeyChar) Then
ElseIf e.KeyChar = ControlChars.Back Then
e.Handled = True
End If
End Sub
End Class

Comments or Responses

Login to post response