Help with Visual Basics

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

spedster

Thread Starter
Joined
Dec 13, 2001
Messages
9
I want to make a form that will have a RichTextBox and a webbrowser on it and then have the browser in the background not seen and pulll the text off of that webpage that opens up and put it to the textbox. I have tried the getwindowtext command and that didn't seem to work. If anyone knows how to do that and or how to just make the richtexbox display that text from the page without having the browserr control on the form please let me know how I can do that.

Thanks

Ted
 
Joined
Mar 24, 2003
Messages
6
If you want the textbox to display the text of the content of the webbrowser, use either of these:
(Choose 1 and Test for best results)

Text1.Text = Webbrowser1.Document.Body.InnerText
Text1.Text = Webbrowser1.Document.Body.outerText
Text1.Text = Webbrowser1.Document.DocumentElement.InnerText
Text1.Text = Webbrowser1.Document.DocumentElement.OuterText

You can also use the following:
Create an IHTMLTextRange:
(don't forget to go to Project --> References, Make sure that Microsoft HTML Object Library has been checked)

Declarations:
Dim TxtRng as IHTMLTxtRange

Command1_Click()
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop

Set TxtRng = WebBrowser1.Document.body.createTextRange
Text1.Text = TxtRng.Text

------------
If you want the RichTextBox to display the WebPage's Text, then replace Text1.Text with RichTextBox1.Text.

Hope This Helps!

:)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top