View Single Post
  #3 (permalink)  
Old 07-10-2009, 7:02 AM
JohnH's Avatar
JohnH JohnH is offline
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,303
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

Another way is this:
Code:
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    Select Case e.KeyCode
        Case Keys.A, Keys.B, Keys.C
            'allowed
        Case Else
            'not allowed
            e.SuppressKeyPress = True
    End Select
End Sub
Keys Enumeration (System.Windows.Forms)
__________________
Reply With Quote