Scrape web page, read results 1 line at a time

I have the code below that scrapes a web page, and put the entire page into "SourceCode".  
I want to loop through "SourceCode" 1 line at a time.
Everything I have tried loops through it 1 character at a time.

Dim SourceRequest As Net.HttpWebRequest = Net.HttpWebRequest.Create("")
        Dim SourceResponse As Net.HttpWebResponse = SourceRequest.GetResponse()
        Dim SourceStream As New IO.StreamReader(SourceResponse.GetResponseStream)
        Dim SourceCode As String = String.Empty
        While SourceStream.EndOfStream = False
            SourceCode &= vbNewLine & SourceStream.ReadLine
        End While
        SourceCode = SourceCode.Trim(vbNewLine)
Who is Participating?
UnifiedISConnect With a Mentor Commented:
Please try switching your while statement to this:
While SourceStream.Peek > 0 --instead of .EndOfStream = False

Not sure if that is it but that is how I consume streamreaders
rrhandle8Author Commented:
"While SourceStream.EndOfStream = False" works fine.  I am sure your solution would also work.
I did not explain the question clearly enough.  Let me try again.

After all the HTML has been captured in SourceCode, how do I read through SourceCode one line at a time?  When I try to do it, I get 1 character at a time.
rrhandle8Author Commented:
Didn't work and no one else offered a solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.