我需要删除richtextbox的最后一行。我尝试了几种方法。但没有任何效果。有人请帮助我
For t = Len(texto) To 0 Step -1
If Mid(texto, t, 1) = vbCr Then
c = c + 1
'texto = Mid(texto, 1, t - 1) don't
End If
'
If c = 2 Then Exit For
Next
RichTextBox2.Text = Left$(texto, t - 1)
答案 0 :(得分:0)
Dim lastLine As Integer = UBound(RichTextBox2.Lines)
If lastLine > -1 Then
Dim newLines() As String
For i As Integer = 0 To lastLine
If i < lastLine Then
ReDim Preserve newLines(i)
newLines(i) = RichTextBox2.Lines(i)
End If
Next
RichTextBox2.Lines = newLines
End If