The vb.net code stucks at While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete

0

I am developing an application in vb.net which fetches some information from the system and then update the details collected to a ready made webpage. I am using the InternetExplorer object for the same. Please find the code below.

Dim WebBrowser1 As Object = CreateObject("InternetExplorer.Application")

Private Sub Button1_Click(sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

WebBrowser1.Visible = True

 WebBrowser1.Navigate("http://abcd.com/webform1.aspx")

    While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
        Application.DoEvents()
    End While


WebBrowser1.Document.GetElementById("infoUserName").InnerText = EndUserName

Here the While condition generates an exception and says that The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

vb.net
asked on Stack Overflow Sep 9, 2015 by Neeraj Gopal • edited Sep 9, 2015 by Umair

1 Answer

0

I have resolved the issue. The url connect.microsoft.com/IE/feedback/details/806858/… explains it more. I have enabled protected mode in IE and it started working fine

answered on Stack Overflow Sep 10, 2015 by Neeraj Gopal

User contributions licensed under CC BY-SA 3.0