BP Forums
Read certain lines - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: Read certain lines (/showthread.php?tid=652)



Read certain lines - brco900033 - 09-19-2012

Hello y'all

How can I read a certain line from a textbox?
Like I want to read the second line out of the 100.

Thanks


Re: Read certain lines - brandonio21 - 09-19-2012

To get the second line you would do something like this:
[code2=vbnet]Dim secondLineText As String = textbox.Text.Split(vbNewLine)(2)[/code2]

Hopefully this helps!


Re: Read certain lines - brco900033 - 09-26-2012

But now it reads two lines;
An empty line
Line2

How can you remove that from it?


Re: Read certain lines - brandonio21 - 09-26-2012

Well, you would simply alter the code a little:
[code2=vbnet]Dim secondLineText As String = textbox.Text.Split(vbNewLine)(2).Remove(0,1)[/code2]