【发布时间】:2020-05-13 13:03:58
【问题描述】:
我希望我的程序自动选择多行文本框中的最后一行文本。
我尝试了以下代码来选择 TextBox 中的第一行:
Private Sub TextBoxLog_TextChanged(sender As Object, e As EventArgs) Handles TextBoxLog.TextChanged
Dim Line As Integer = TextBoxLog.GetLineFromCharIndex(TextBoxLog.Lines.GetLowerBound(0))
Dim lineLength As Integer = TextBoxLog.Lines(Line).Length
TextBoxLog.SelectionStart = TextBoxLog.GetLineFromCharIndex(Line)
TextBoxLog.SelectionLength = lineLength
End Sub
如何修改上面的代码,以便在文本更改时自动选择最后一行?
我想我只需要更改上面代码 sn -p 中的第二行。
注意: TextBox 设置为只读,并通过单击按钮填充文本。
【问题讨论】: