[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

WebBrowser control

I'm creating an internet app with a browser control.
I'd like to know how to get the html source (like the view source menu in Internet Explorer) or to select all the content of a web page and copy it to the clipboard.
Thank you.
Minette
0
minette
Asked:
minette
  • 6
  • 3
  • 2
1 Solution
 
AzraSoundCommented:
use the internet transfer control
from projects -> components choose microsoft internet transfer control
to get the source use this code

Dim source As String
source = Inet1.OpenUrl("http://www.somesite.com")
0
 
AzraSoundCommented:
for the clipboard you can use it this way:

Clipboard.SetText Inet1.OpenURL("http://www.experts-exchange.com")

0
 
mcriderCommented:
There is a complete webbrowser example on your Visual Basic CD... Load the project in: \TOOLS\UNSUPPRT\HTTPEXPL

I think this is everything you need...


Cheers!®©
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
minetteAuthor Commented:
mcrider,
The example on the CD doesn't show what i need :-)

AzraSound,
Your solution is quite good but when trying to get the source code of a webpage, only about half was displayed.
Do you have a solution for that or maybe i've done something wrong ?

Any idea about "Select all" the content of a web page and Copy it (that way, i wouldn't have html tags).

0
 
mcriderCommented:
When you run the example application I told you about and load a URL using "File->Open URL" the source of the document appears in the upper-righthand window... I thought you wanted the source of the HTML document???


Cheers!®©
0
 
AzraSoundCommented:
which sites are you not getting all the source from?
0
 
AzraSoundCommented:
hello try this method instead:

Text1.Text = WebBrowser1.Document.body.innerhtml
0
 
AzraSoundCommented:
solution i gave will only work for a page with no frames, here is the complete answer:

to get the number of frames on the page use this

MsgBox WebBrowser1.Document.frames.length


to get any source from any frame:

Text1.Text = WebBrowser1.Document.frames(x).Document.body.innerhtml

where x is the frame number/index of the frame you want to view




0
 
minetteAuthor Commented:
Answer accepted
0
 
minetteAuthor Commented:
Sorry for the late answer !
It works fine.
Thanks.
0
 
AzraSoundCommented:
glad i could help  =)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now