Solved

WebBrowser control

Posted on 2000-05-11
11
179 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
  • 6
  • 3
  • 2
11 Comments
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:minette
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 28

Expert Comment

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

Expert Comment

by:AzraSound
Comment Utility
hello try this method instead:

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

Accepted Solution

by:
AzraSound earned 90 total points
Comment Utility
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
Comment Utility
Answer accepted
0
 

Author Comment

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

Expert Comment

by:AzraSound
Comment Utility
glad i could help  =)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now