Webbrowser

V

Vadim Rapp

Hello,

I want to create a webbrowser object programmatically, navigate to a URL,
and then analyze the document.

I create the following code (simplified):

Dim ie as new webbrowser
ie.navigate "http://www.google.com"
do while isnothing(ie.document)
threading.thread.sleep 1000
loop

This does not work; there's no error, but browser object does not navigate
anywhere. Same as if I declare the ebject with withevents, navigate, and
then expect callback - it never comes.

Navigation works if I create a separate form and put webbrowser control on
it.

Why it does not work as an object?

thanks,
Vadim Rapp
 
H

Herfried K. Wagner [MVP]

Vadim Rapp said:
I want to create a webbrowser object programmatically, navigate to a URL,
and then analyze the document.

I create the following code (simplified):

Dim ie as new webbrowser
ie.navigate "http://www.google.com"
do while isnothing(ie.document)
threading.thread.sleep 1000
loop

This does not work; there's no error, but browser object does not navigate
anywhere. Same as if I declare the ebject with withevents, navigate, and
then expect callback - it never comes.

Use the code listed at
<URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile> to download a
file.
 
V

Vadim Rapp

Hello, Herfried!
You wrote on Sun, 24 Dec 2006 18:58:52 +0100:

??>> I want to create a webbrowser object programmatically, navigate to a
??>> URL, and then analyze the document.
??>>
??>> I create the following code (simplified):
??>>
??>> Dim ie as new webbrowser
??>> ie.navigate "http://www.google.com"
??>> do while isnothing(ie.document)
??>> threading.thread.sleep 1000
??>> loop
??>>
??>> This does not work; there's no error, but browser object does not
??>> navigate anywhere. Same as if I declare the ebject with withevents,
??>> navigate, and then expect callback - it never comes.

HKW> Use the code listed at
HKW> <URL:http://dotnet.mvps.org/dotnet/code/net/#InternetLoadFile> to
HKW> download a file.

Thanks, but the problem is, I need to analyze the retrieved document. With
webrequest, I get a text stream, and I don't see how I can easily convert it
into htmldocument. If I save the stream to file and then navigate to it, the
relative links in the document will not resolve correctly.

I was just curious why webbrowser so much insists on being in a container.

thanks,

Vadim Rapp
 

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