Solved

WebBrowser control

Posted on 2000-05-11
11
180 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
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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

895 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

15 Experts available now in Live!

Get 1:1 Help Now