Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Question is how can i get frame.length in IE_DocumentComplete.

my code: (vb.net 2013)
Public Class Form1<br />
    Private WithEvents IE As SHDocVw.InternetExplorer<br />
    Private Doc As mshtml.HTMLDocument<br />
<br />
    Private Sub IE_DocumentComplete(pDisp As Object, ByRef URL As Object) Handles IE.DocumentComplete<br />
        Doc = IE.Document<br />
        MsgBox(Doc.frames.length)  ' **System.InvalidCastException error here**<br />
    End Sub<br />
<br />
    Private Sub main_Load(sender As Object, e As EventArgs) Handles MyBase.Load<br />
        IE = New SHDocVw.InternetExplorer()<br />
        IE.Visible = True<br />
<br />
        IE.Navigate("https://www.google.co.jp")<br />
        waitIE(IE)<br />
<br />
   End Sub<br />
<br />
    Private Sub waitIE(ByVal objIE As SHDocVw.InternetExplorer)<br />
        Do Until objIE.ReadyState = SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE Or objIE.Busy = False<br />
            Application.DoEvents()<br />
            'System.Threading.Thread.Sleep(100)<br />
        Loop<br />
<br />
        Do While objIE.Document.ReadyState <> "complete"<br />
            Application.DoEvents()<br />
        Loop<br />
    End Sub<br />
End Class


Thanks for your Help
Greets
Mame
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900