tags:

views:

38

answers:

1

Hello, I'm using the webBrowser object to surf to a page that has an Iframe. I'm trying to get the Specific objects in this iframe by using the GetElementByID function. I do something like this: webBrowser1.document.GetelementByID("iframeName").document.GetElementByID("ElementName)

It doesn't work. I get Null.

Any ideas?

TY

+2  A: 

The Document property gets the HtmlDocument object that owns the element, not the document in the <iframe>.

Instead, you should use the HtmlWindow.Frames collection, like this:

myWebBrowser.Document.Window.Frames["IFrameName"].Document.GetElementByID("ElementName")
SLaks
HEYYYYYY!!!! Perfect!!!!I was looking for this solution for a long time.Thank you very much.