C# WebBrowser control problem
I'm开发者_C百科 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?
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.
精彩评论