View Single Post
  #2 (permalink)  
Old 07-09-2009, 10:18 PM
danijel.drmic danijel.drmic is offline
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jul 2009
Age: 25
Posts: 10
Reputation: 11
danijel.drmic is on a distinguished programming path ahead
Default

For example, if you want to textbox2 allow import of only the digits from 1 to 5 try this:

Code:
    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        If e.KeyChar < Chr(49) Or e.KeyChar > Chr(53) Then e.Handled = True
    End Sub

maybe you will need this:
Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion


I hope that I helped
Reply With Quote