'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • techfox
    New Member
    • Dec 2015
    • 1

    'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll

    I'm getting the following error when debugging. Can someone shed some light?

    - I'm running it x86.
    - It opens up IE, and Navigates to the URL, but does not fill in the form details.
    - It highlights the
    Code:
    Do Until IE.ReadyState = 4




    Thanks,



    An unhandled exception of type 'System.Runtime .InteropService s.COMException' occurred in mscorlib.dll

    Additional information: The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNE CTED))


    Code:
    Public Class Form1
        Dim IE As Object
    
        Dim SMPLogin As String = "Username"
        Dim SMPPass As String = "Password"
        Dim SMPURL As String = "http://mydomain.com/Login.srq"
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    
            IE = CreateObject("InternetExplorer.Application")
            IE.Visible = True
            IE.Navigate2(SMPURL)
    
            ' Wait for IE to open the URL
            Do Until IE.ReadyState = 4
            Loop
    
            ' Input form fields.
            IE.Document.GetElementById("username").SetAttribute("value", SMPLogin)
            IE.Document.GetElementById("password").SetAttribute("value", SMPPass)
            IE.Documnet.GetElementById("submit").InvokeMember("click")
        End Sub
    End Class
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    #2
    Can you please try this... IE.BUSY unless the page loads.

    Regards.

    Comment

    Working...