Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract text with document property from IE window?? 1

Status
Not open for further replies.

rbengali

Programmer
May 20, 2004
3
US
Hi,

I'm having a problem with retrieving some text from an Internet Explorer browser window. The window was created by my program, and it only has one line of text on it.

Here's what I have so far:

SHDocVw.InternetExplorer ie = new SHDocVw.InternetExplorerClass();
IWebBrowserApp commWindow = (IWebBrowserApp) ie;

(after navigating and loading the site with commWindow)
commWindow.Document.....
now I am unsure what to do. In VB.Net, it looked something like this:
commWindow.Document.Body.InnerText

I have looked around the web, and I think I might have to use something like:
HTMLDocument wd = (HTMLDocument)commWindow.Document;

However, this brings about compiler errors (can't find type HTMLDocument). I am completely lost on how to do this. Any help would be greatly appreciated! Thanks!

Raheel
 
You have to cast the document object to a HTML document. You must of course have the appropriate references loaded.

There is a thread in this forum on the topic. A search for "Browser Control" should find the thread.



Thomas D. Greer
Providing PostScript & PDF
Training, Development & Consulting
 
Great, thanks a lot Thomas.

Your code was helpful in getting me started to making this line of code, which solved all problems!

((IHTMLDocument2)commWindow.Document).body.innerText;

Thanks again,
Raheel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top