VB.NET删除文本框的第一行

时间:2011-08-02 05:47:25

标签: vb.net textbox

如何在按下按钮时删除文本框的第一行?

2 个答案:

答案 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