Discussion:
automating ie or webbrowser control
(too old to reply)
Scott Baxter
2009-05-28 19:35:08 UTC
Permalink
Hello,

In VB 6 I could easily get to the document object of either internet
explorer, or the web browser control, and get all the links, etc. through
arrays.

In VB.net I can't even seem to assign the document object to a variable
(thedoc). So I can't get to any of the info I need.

Is there something I'm missing?

Here's the code I used, or attempted to use.

Thanks.

Scott

Public IE As SHDocVw.InternetExplorer
Dim ie As SHDocVw.InternetExplorer
ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.Navigate("http://www.msn.com")
Do While ie.Busy
Application.DoEvents()
Loop
dim iestuff as string=""
For ix As Integer = 0 To thedoc.Links.Count - 1
iestuff = iestuff & thedoc.Links(ix).href & ControlChars.CrLf
Next
James Whitlow
2009-05-28 20:32:38 UTC
Permalink
Post by Scott Baxter
Hello,
In VB 6 I could easily get to the document object of either internet
explorer, or the web browser control, and get all the links, etc. through
arrays.
In VB.net I can't even seem to assign the document object to a variable
(thedoc). So I can't get to any of the info I need.
Is there something I'm missing?
Here's the code I used, or attempted to use.
Thanks.
Scott
Public IE As SHDocVw.InternetExplorer
Dim ie As SHDocVw.InternetExplorer
ie = New SHDocVw.InternetExplorer
ie.Visible = True
ie.Navigate("http://www.msn.com")
Do While ie.Busy
Application.DoEvents()
Loop
dim iestuff as string=""
For ix As Integer = 0 To thedoc.Links.Count - 1
iestuff = iestuff & thedoc.Links(ix).href & ControlChars.CrLf
Next
Try the below code and see if it does what you want. It's basically the
same thing you posted, just changed to VBScript syntax.

Set oIE = CreateObject("InternetExplorer.Application")
oIE.visible = True
oIE.navigate "http://www.msn.com"
Do While oIE.busy
WScript.Sleep 100
Loop
For Each sLink in oIE.document.links
sLinks = sLinks & sLink & vbCrLf
Next
MsgBox sLinks
Cor Ligthert[MVP]
2009-05-29 08:08:57 UTC
Permalink
Scott,

Since version VB8 there is a special Net webbrowser (which uses ShDocVw as
well)

You are using the old Intereop one, in fact that one should work the same as
in VB6 an VB7 but it is possible that it is not exact like that.

Try to avoid that do events loop, that completely eats your processing.
As you want a stop use sleep, or better an even about the document complete.

By the way, your post is in all other newsgroups you posted too beside
languages.vb simply spam.

Cor
Scott Baxter
2009-05-29 20:07:02 UTC
Permalink
Hello,

Thanks. I'll look for that Net Webbrowser.

I had made some posts without much answer, so I posted to the other groups
in hope of a response. Sorry for any inconvenience.

Scott
Post by Cor Ligthert[MVP]
Scott,
Since version VB8 there is a special Net webbrowser (which uses ShDocVw as
well)
You are using the old Intereop one, in fact that one should work the same
as in VB6 an VB7 but it is possible that it is not exact like that.
Try to avoid that do events loop, that completely eats your processing.
As you want a stop use sleep, or better an even about the document complete.
By the way, your post is in all other newsgroups you posted too beside
languages.vb simply spam.
Cor
Loading...