automating ie or webbrowser control

S

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
 
J

James Whitlow

Scott Baxter said:
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
 
J

James Whitlow

Scott Baxter said:
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
 
C

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
 
C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top