如何在按下按钮时删除文本框的第一行?
答案 0 :(得分:5)
试试这个:
Dim b As String() = Split(TextBox1.Text, vbNewLine)
TextBox1.Text = String.Join(vbNewLine, b, 1, b.Length - 1)
请参阅String.Join以供参考。
答案 1 :(得分:1)
相当容易:
Private Sub bttnFirstLine_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bttnFirstLine.Click
txtBox.Text = txtBox.Text.Substring(txtBox.Text.IndexOf(vbCrLf))
end sub
或
Private Sub bttnFirstLine_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bttnFirstLine.Click
dim myString = txtBox.text
txtBox.Text = myString.Substring(myString.IndexOf(vbCrLf))
end sub