1
Reply

How can i make user writes only character in a textbox

boujarmoune ismail

boujarmoune ismail

Jul 12 2012 2:56 AM
1.1k
i try this but it dosen't work
 
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Dim x As String = Nothing
        If TextBox1.TextLength > 0 Then
            For j As Integer = 0 To TextBox1.Text.Count - 1

                If Char.IsNumber(TextBox1.Text(j)) Or Char.IsSymbol(TextBox1.Text(j)) Then
                    t = j
                    Dim s As String() = Split(TextBox1.Text, TextBox1.Text(j))
                    For i As Integer = 0 To s.Count - 1
                        x = x & s(i)
                    Next
                    TextBox1.Text = x
                    Exit Sub
                End If

            Next
        End If

    End Sub

Answers (1)