An object-oriented programming language developed by Microsoft that can be used in .NET.
Hi @OSVBNET ,
Try the code below.
Dim lenth As Integer = 0
Private Sub MessageTextBox_TextChanged(sender As Object, e As EventArgs) Handles MessageTextBox.TextChanged
Dim sel = MessageTextBox.SelectionStart
Dim lenth_change = MessageTextBox.TextLength - lenth
Dim FileNameFilter As String = MessageTextBox.Text
MessageTextBox.Text = ""
For MyLoop = 0 To FileNameFilter.Length - 1
Select Case Convert.ToInt32(FileNameFilter.Chars(MyLoop))
Case 32, 45, 46, 48 To 57, 64, 65 To 90, 97 To 122, 10
MessageTextBox.AppendText(FileNameFilter.Chars(MyLoop).ToString)
End Select
Next
MessageTextBox.SelectionStart = sel
If MessageTextBox.TextLength - lenth >= 0 Then
MessageTextBox.SelectionStart = MessageTextBox.SelectionStart - (lenth_change - (MessageTextBox.TextLength - lenth))
End If
lenth = MessageTextBox.TextLength
End Sub
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.