Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET Removing first line of a textbox

Tags:

vb.net

textbox

How can i remove the first line of a textbox on a button press?

like image 265
Kassy Daniels Avatar asked Aug 02 '11 05:08

Kassy Daniels


2 Answers

Try this :

  Dim b As String() = Split(TextBox1.Text, vbNewLine)

  TextBox1.Text = String.Join(vbNewLine, b, 1, b.Length - 1)

See String.Join for reference .

like image 122
Sandeep Pathak Avatar answered Sep 24 '22 13:09

Sandeep Pathak


fairly easy:

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

or

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
like image 37
Qqbt Avatar answered Sep 21 '22 13:09

Qqbt