Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim i As Integer = TextBox1.Text.Length - 1 Dim a As Char If i > -1 Then a = TextBox1.Text.Remove(0, i) If a.IsNumber(a) = False Then TextBox1.Text = TextBox1.Text.TrimEnd(a) TextBox1.SelectionStart = i + 1 End If Else TextBox1.Text = String.Empty End If End Sub 自己看看这个例子