Hey, im trying to run this code and keep running into "Specified cast is not valid" for the line with Temp.document. etc.
It is allowing me to access all of IE's properties except for parentWindow. Im not sure what to do here. Does anyone have any ideas?
a Code:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BackgroundWorker1.RunWorkerAsync() End Sub Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Dim Temp As Object Temp = CreateObject("InternetExplorer.Application") Temp.Visible = True Temp.Navigate("http://www.google.com") Do Until Temp.ReadyState = 4 Loop 'MsgBox(Temp.document.body.innerHtml) 'this works but parentwindow doesnt Temp.document.parentWindow.execScript("alert('test')") End Sub End Class




Reply With Quote