here:
VB Code:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged TextBox1.Text = filterText(TextBox1.Text) End Sub Private Function filterText(ByVal txt As String) As String If txt Is Nothing Then Return Nothing Const numbers As String = "1234567890" Dim filtered As String = "" Dim i As Integer Dim aChar As String For i = 0 To txt.Length - 1 aChar = txt.Substring(i, 1) ' See if this character is a number If numbers.IndexOf(aChar) <> -1 Then filtered &= aChar End If Next Return filtered End Function




Reply With Quote