VB.NET Removing the first line of a text field

How to delete the first line of a text field by clicking a button?

+4
source share
2 answers

Try the following:

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

See String.Join for help.

+5
source

pretty 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 
+1
source

All Articles