Unanswered VSTO + WebBrowswer: incompatible !

All Replies

  • Tuesday, March 06, 2012 8:28 AM
     
     

    Hi,

    I am bumping this thread again since there hasn't been response so far. Has anyone ever tested the combination of form's WebBrowser control with Excel VSTO? I really have no idea why the former cannot display webpage when used with VSTO.

    It is urgent, please help!

    Bob

  • Tuesday, March 06, 2012 9:56 AM
     
     
    I used WebBrowser control embedded in excel no longer then yesterday and it worksed fine. Be advised though that you should use webbrowser control from excel toolbox in VS designer or use methods like AddWebBrowser. Are you using WebBrowser from WinForms library?
  • Wednesday, March 07, 2012 6:45 AM
    Moderator
     
      Has Code

    Hi Bob,

    Welcome to the MSDN forum!

    I tested the WebBrowser control within a form in the VSTO project. It works fine.

    The code is shown as below:

       Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Navigate(TextBox1.Text)
        End Sub
    
        Private Sub Navigate(ByVal address As String)
    
            If String.IsNullOrEmpty(address) Then Return
            If address.Equals("about:blank") Then Return
            If Not address.StartsWith("http://") And _
                Not address.StartsWith("https://") Then
                address = "http://" & address
            End If
    
            Try
                webBrowser1.Navigate(New Uri(address))
            Catch ex As System.UriFormatException
                Return
            End Try
    
        End Sub

    Hope it helps.

    Have a nice day!

    yoyo


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us

  • Sunday, March 11, 2012 3:13 PM
     
     

    Yoyo,

    Sorry for my delayed reply.

    I copied in verbatim and tested the code, and got the following message in the output window after trigering the browswer navigation with the button click:

    "A first chance exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll"

    Do you know the possible cause of the problem?

    Bob

  • Monday, March 12, 2012 2:48 AM
    Moderator
     
     

    Hi Bob,

    Have you new a form in the project before you copied the code? The webbrowser is hosted in a form. 

    You can download the demo project (VS2010 + Excel 2010 )from here:

    https://skydrive.live.com/redir.aspx?cid=37142ebae462f7f1&resid=37142EBAE462F7F1!136&parid=37142EBAE462F7F1!118  

    Hope it helps.

    Let me know if you need any help.

    Have a nice day!

    yoyo


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us

  • Monday, March 12, 2012 8:04 AM
    Answerer
     
     

    Hello Bob,

    what is your environment?

    Do you running on an 64Bit machine?
    Do you installed a 64-Bit Version of Office?

    I can remember there is an Issue, that you cannot display Active-X Controls in 64-Bit Browsers.

    Not sure if this helps,

    Greets - Helmut


    Helmut Obertanner [http://www.obertanner.de] [http://www.outlooksharp.de]

  • Monday, March 12, 2012 11:43 AM
     
     

    Yoyo,

    I tried

    1. Open the .xlsx file directly in the \bin\debug folder

    2. Open the project in VS2010.

    For both I got the same symptom, i.e., constantly showing busy status mouse cursor without displaying web content, exactly as with my own projects.

    I think the problem should be attributed to settings of my own environment. Do you know what could cause this?

    Helmut,

    I am using IE9 on Win 7 32-bit Home Premium version.

    Bob



    • Edited by Bob Sun Monday, March 12, 2012 11:45 AM
    •  
  • Monday, March 12, 2012 12:14 PM
     
     
    check using fiddler if requests actually go to site (also subsequent ones, for js, css, etc.) or does it hang before that.