Itay.B
Itay.B

Reputation: 4111

C# WebBrowser control problem

I'm using the webBrowser control to surf to a page that has an Iframe. I access the Iframe object like this:

WebBrowser1.Document.Window.Frames["IFrameName"] 

The problem is that sometimes the Frames collection has no frames and sometimes it does.

What might be the reason that the same exact code one time works fine and i get the iframe and few minutes later it's throwing an exception because the frame is not there?

Upvotes: 0

Views: 447

Answers (1)

scartag
scartag

Reputation: 17680

AT what point are u making the call to the Frames collection? Are you doing this after the DocumentCompleted event?

That could make a difference ... you could handle the documentcompleted event and only make the call after the document has loaded.

Upvotes: 1

Related Questions