NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model.
A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.
Your use of Stack Overflow’s Products and Services, including the Stack Overflow Network, is subject to these policies and terms.
Handled = True End If End Sub Public Sub Not Null_Leave(By Val sender As Object, By Val e As System. Show("Please Enter a Number from 1 to 10") End If Text Box1. Focus() End Sub "."c Then Msg Box("Please Enter Numbers only", Msg Box Style. Then a combination of 'Shift' key and 'Number' keys (which denotes Symbols) also not needed. Hence all these are included in the Text Box declaration itself which produces the desired result. First, in any case, unless your application would require, blocking user's key entry is somehow not a good thing to do, users may misinterpret the action as problem on the hardware keyboard and at the same time may not see where their keypreesed entry error came from. Click Dim the Number As Integer Dim the Entry As String = Trim(Text Box1. Property Changed Public Sub On Property Change(By Val e As Property Changed Event Args) If Not Property Changed Event Is Nothing Then Raise Event Property Changed(Me, e) End If End Sub End Class Public With Events _Your Variable as New Properties Public Sub New() Initialize Component() With Your Text Box . This may be too late, but for other new blood on VB out there, here's something simple. Regular Expressions Module Module1 Public Enum Validation Type Only_Numbers = 1 Only_Characters = 2 Not_Null = 3 Only_Email = 4 Phone_Number = 5 End Enum Public Sub Assign Validation(By Ref CTRL As Windows. Text Box, By Val Validation_Type As Validation Type) Dim txt As Windows. Text Box = CTRL Select Case Validation_Type Case Validation Type. Key Press, Address Of number_Leave Case Validation Type. Key Press, Address Of OCHAR_Leave Case Validation Type. Leave, Address Of Not Null_Leave Case Validation Type. Leave, Address Of Email_Leave Case Validation Type. Key Press, Address Of Phonenumber_Leave End Select End Sub Public Sub number_Leave(By Val sender As Object, By Val e As System. Focus() End If End Sub Public Sub Email_Leave(By Val sender As Object, By Val e As System. Text), "^([0-9a-z A-Z]([-.\w]*[0-9a-z A-Z])*@([0-9a-z A-Z][-\w]*[0-9a-z A-Z]\.) [a-z A-Z])$", Regex Options. Show("Please Enter a valid Email Address", "Information", Message Box Buttons. White End If End If End Sub End Module Private Sub Form1_Load(By Val sender As System. Text, "") End Sub Private Sub txt Case ID_Key Press(By Val sender As Object, By Val e As System. Key Char = "" End Sub Private Sub My Text Box_Key Press(sender As Object, e As System.