Creates a webbrowser in a background thread, then is supposed to navigate to a url and return a htmldocument, but the navigate fails for some reason, any idea why?
NOTE: this is part of a class where you see ME.url or me. ... me.isrunning = boolean false by default me.url = uri of location to navigate to
Public Function GetDOC(ByVal url As Uri) As HtmlDocument
If Me.IsRunning Then
Throw New Exception("Object Currently In use")
End If
htmdoc = Nothing
Dim cp As New Threading.Thread(AddressOf thrdowo)
cp.SetApartmentState(Threading.ApartmentState.STA)
cp.Start()
run = True
While run
End While
Return htmdoc
End Function
Private Sub thrdowo()
Dim cbl As New WebBrowser
'cbl.Url = Me.URL
cbl.Navigate("about:blank")
cbl.Navigate(Me.URL)
While cbl.IsBusy
End While
htmdoc = cbl.Document
run = False
End Sub