Solved

WebBrowser control

Posted on 2000-05-11
11
186 Views
Last Modified: 2010-08-05
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
Comment
Question by:minette
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2802845
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2802959
for the clipboard you can use it this way:

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

0
 
LVL 14

Expert Comment

by:mcrider
ID: 2803071
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:minette
ID: 2804336
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
 
LVL 14

Expert Comment

by:mcrider
ID: 2804383
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
 
LVL 28

Expert Comment

by:AzraSound
ID: 2804897
which sites are you not getting all the source from?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2883988
hello try this method instead:

Text1.Text = WebBrowser1.Document.body.innerhtml
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 90 total points
ID: 2895905
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
 

Author Comment

by:minette
ID: 3130680
Answer accepted
0
 

Author Comment

by:minette
ID: 3130681
Sorry for the late answer !
It works fine.
Thanks.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 3130694
glad i could help  =)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question