Hi,
Can someone help me with this issue??
I am trying to get html element from a stream

this is the stream:

Dim request As WebRequest = HttpWebRequest.Create("http://www.mysite.com/")
Dim response As WebResponse = request.GetResponse()
Dim stream As Stream = response.GetResponseStream()

How can I get the html elements from it?
(I DO NOT WANT TO USE WEBBROWSER CONTROL)

Then I will do something like...

For Each element As HtmlElement In XXXXXXXX
       ListBox1.Items.Add(element.GetAttribute("href"))
Next

PLS HELP ME!
THANKS!!!! &)

WOW!
This is exactly what I needed!
But I got an error while running this code:

Dim objLink As HTMLLinkElement        
Dim objMSHTML As New mshtml.HTMLDocument
Dim objDocument As mshtml.HTMLDocument
objDocument = objMSHTML.createDocumentFromUrl("http://www.facebook.com/", "")
***Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
While objDocument.readyState <> "complete"
    Application.DoEvents()
End While
For Each objLink In objDocument.links
    ListBox1.Items.Add(objLink)
Next

Why is it?

It seems to be a debbuger or compile error
I manage to get the VS message:
An unhandled exception of type 'System.AccessViolationException' occurred in mscorlib.dll

Still no solution.
Is there any other way to Get Html element without using webbrowser?

You can create a string parser of some type.

Dim request As WebRequest = HttpWebRequest.Create("http://www.mysite.com/")
Dim response As WebResponse = request.GetResponse()
Dim stream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(stream)
Dim line As String

While reader.Peek > -1
   line = reader.ReadLine()
   If line.Contains("href") Then
      'Do something with this line containing a href tag.
   End If
End While
This article has been dead for over six months. Start a new discussion instead.