locked
Windows.Forms.WebBrowser control standard double-click behavior not working RRS feed

  • Question

  • One of my projects uses the Windows.Forms.WebBrowser control as an editor and viewer for HTML. It has been working fine for years but suddenly I noticed that before when I would double-click it would automatically select the word which was clicked (this was not my code, just happened with the control).

    Suddenly (not exactly sure when), double clicking text in the control (both in edit mode or in view mode) does nothing. It's hard to troubleshoot because it is not my code doing it, however, since I depended on this functionality in the past, it is now impacting my final product.

    Any idea what would have recently changed (in Windows or in .Net) which would affected this (the same version of my app works fine in older Win7 but not in the most up-to-date Win7)? Also, how can I get the previous functionality back? Must I wire up my own double-click even on the DOM and then start parsing the text to manually select it (uh!)?

    I've looked all over for the answer to this question but mostly I just see how to wire up to DOM events, nothing about recent changes which would cause the problem above). Any help would be greatly appreciated.

    I'm using VS 2010, VB, Win7 x64, IE 10.0.6, .Net 3.5 (whatever the latest one is) when the problem happens (compiled so I doubt it is VS or VB).

    When I run the exact same code (compiled) on Win7 x86 with IE 8 (Win7 Pro plain, with zero-updates installed) it works just fine.

    After some further testing, on the Win7 x86 fresh install (where everything was fine) as soon as I install IE 10 and NOTHING ELSE the problem starts to happen. So, I'm pretty sure the problem lies with IE 10.

    Steps to reproduce:

     1. Create a new VB.Net project in VS 2010, targetting .Net 3.5
     2. Create a usercontrol <--- this step is the key
     3. Add a webbrowser to the usercontrol
     4. Add this code to the usercontrol

            Public Sub LoadHTML(html As String)
                WebBrowser1.DocumentText = html
        
                Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                    Application.DoEvents()
                Loop
        
                WebBrowser1.Document.Body.SetAttribute("contentEditable", "false")
            End Sub

     5. Add that control to a form
     6. Add a button to the form with the following button.Click event:

            Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
                UserControl1.LoadHTML("<html><body>This is a test interesting is it not?</body></html>")
            End Sub

     7. Run the project and click the button
     8. Then, try to double-click the word "interesting" and notice it does not select.

    If you throw the webbrowser control directly on the form, it will work fine. The problem is with the usercontrol (and it is only a problem after updating to IE10).
    • Edited by John M. Andre Sunday, July 7, 2013 1:40 AM Added sample code and steps to reproduce
    Saturday, July 6, 2013 11:34 AM

Answers

  • I have actually just confirmed a workaround. I have not been able to reproduce the error if I modify the two mentioned properties of the webbrowser from the load event of the form that contains the usercontrol.

    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
        'When this first loads, test double clicking of a word in the webbrowser to confirm it works
        'After you have confirmed that you can double click a word,
        'Now uncomment one of the specified lines below and try to double click a word again
        Friend WithEvents TestUserControl1 As New TestUserControl With {.Parent = Me}
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TestUserControl1.WebBrowser1.AllowWebBrowserDrop = True 'Setting these properties here does not cause the error
            TestUserControl1.WebBrowser1.ScriptErrorsSuppressed = False 'Setting these properties here does not cause the error
            TestUserControl1.WebBrowser1.DocumentText = "<html><body>These are test words that you can attempt to double click</body></html>"
        End Sub
    End Class
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class TestUserControl
        Inherits System.Windows.Forms.UserControl
        Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
        Private components As System.ComponentModel.IContainer
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then components.Dispose()
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.WebBrowser1 = New System.Windows.Forms.WebBrowser()
            Me.SuspendLayout()
            'WebBrowser1
            'Me.WebBrowser1.AllowWebBrowserDrop = False 'Uncomment this line to test the error(You can set this value to true or false)
            Me.WebBrowser1.Location = New System.Drawing.Point(20, 3)
            Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
            Me.WebBrowser1.Name = "WebBrowser1"
            'Me.WebBrowser1.ScriptErrorsSuppressed = True  'Uncomment this line to test the error(You can set this value to true or false)
            Me.WebBrowser1.Size = New System.Drawing.Size(147, 138)
            Me.WebBrowser1.TabIndex = 0
            'TestUserControl
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.Controls.Add(Me.WebBrowser1)
            Me.Name = "TestUserControl"
            Me.Size = New System.Drawing.Size(228, 186)
            Me.ResumeLayout(False)
        End Sub
    End Class


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    • Proposed as answer by ahmedilyas Sunday, August 4, 2013 4:36 PM
    • Unproposed as answer by John M. Andre Wednesday, August 7, 2013 2:43 AM
    • Marked as answer by John M. Andre Wednesday, August 7, 2013 5:20 AM
    Sunday, August 4, 2013 4:35 PM

All replies

  • Visual Studio 2012, Win 7 64bit current, IE 10

    I created a Form with a WebBrowser control and navigated to Yahoo. Double clicked on the word "one" and it works fine.


    Please BEWARE that I have NO EXPERTISE! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become unstable or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, July 6, 2013 4:02 PM
  • Yeah, you're right. If you add the webbrowser control to a form it works. However, if you add it to a usercontol and then add that usercontrol to the form, it does not work.

    Take a look at the steps to reproduce above (just added).

    Sunday, July 7, 2013 1:41 AM
  • if you add it to a usercontol and then add that usercontrol to the form, it does not work.

    Take a look at the steps to reproduce above (just added).

    I didn't follow your exact steps, but I met the following criteria:

    1.) Add a webbrowser to usercontrol

    2.) Add usercontrol to form

    3.) Visual Basic 2012 Express

    I did not get any errors, all body text was displayed, and double click highlighted the word, and triple click highlighted the sentence as expected.

    Option Strict On
    Public Class Form1
        Friend WithEvents uc1 As New MyUserControl With {.Parent = Me}
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            uc1.LoadHTML("<html><body><center>This is a test interesting is it not?</center></body></html>")
        End Sub
    End Class
    Public Class MyUserControl
        Inherits UserControl
        Friend WithEvents Webbrowser1 As New WebBrowser With {.Parent = Me, .Dock = DockStyle.Fill}
        Public Sub LoadHTML(html As String)
            WebBrowser1.DocumentText = html
            Webbrowser1.Document.Body.SetAttribute("contentEditable", "false")
        End Sub
    End Class


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Sunday, July 7, 2013 7:40 AM
  • Your code causes the same error as my code.

    Therefore, it must be something different about your machine.

    Do you have IE 10 installed?

    I can reproduce the problem using VS 2010 using .Net 3.5 and 4.0.

    I can reproduce the problem using VS 2012 using .Net 4.5.


    • Edited by John M. Andre Sunday, July 7, 2013 10:14 AM fixing English
    Sunday, July 7, 2013 10:12 AM
  • Your code causes the same error as my code.

    Therefore, it must be something different about your machine.

    Do you have IE 10 installed?

    I can reproduce the problem using VS 2010 using .Net 3.5 and 4.0.

    I can reproduce the problem using VS 2012 using .Net 4.5.



    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles

    *This post does not reflect the opinion of Microsoft, or its employees.

    • Edited by Paul Ishak Sunday, July 7, 2013 10:31 AM modify
    Sunday, July 7, 2013 10:29 AM
  • Our machines are almost identical. The only difference is that I use Win7 Pro x64 and you use Ultimate.

    You use VS 2012 express while I use the ultimate version. I doubt these differences account for the problem.

    I can easily reproduce the problem in a new VM with only Win7 Pro x86 with SP1 (and no other updates) installed. I run the code and it works fine. I install IE 10 and no other updates and the problem starts happening.

    Can you reproduce inside a clean VM as described above?

    Sunday, July 7, 2013 11:15 AM

  • Can you reproduce inside a clean VM as described above?

    I don't have any vm's installed at the moment... I'm sure someone else can as soon as they see your request... But at least you know the code is good, and that it has something to do with your installation/configuration/system.

    Maybe there is something running in your app, or on your computer that is disrupting the double-clicking, or maybe it's related to your mouse settings in control panel?



    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Sunday, July 7, 2013 11:20 AM
  • If I run YOUR code inside a fresh Win7 Pro x86 install, I get the problem. I don't think its something running inside my app as my whole app is only about 10 lines of code.

    If the problem were mouse settings, I would think the behavior would not be different inside a VM simply by installing IE 10.

    The reason I'm so hung up on IE 10 is that before I install it, everything is fine. Same everything and literally the ONLY change is installing IE 10 and the problem behavior starts happening. Super-reproducible.

    Since IE 10 is the ONLY change, that must be involved in the problem in some way.

    Sunday, July 7, 2013 11:28 AM
  • If I run YOUR code inside a fresh Win7 Pro x86 install, I get the problem. I don't think its something running inside my app as my whole app is only about 10 lines of code.

    If the problem were mouse settings, I would think the behavior would not be different inside a VM simply by installing IE 10.

    The reason I'm so hung up on IE 10 is that before I install it, everything is fine. Same everything and literally the ONLY change is installing IE 10 and the problem behavior starts happening. Super-reproducible.

    Since IE 10 is the ONLY change, that must be involved in the problem in some way.

    Here is my version of VS2012...

    Just for the sake of clarification, this IS what you're unable to do, correct? If so, I've already confirmed no issues...

    Option Strict On
    Public Class Form1
        Friend WithEvents uc1 As New MyUserControl With {.Parent = Me}
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            uc1.LoadHTML("<html><body><center>This is a test interesting is it not?</center></body></html>")
        End Sub
    End Class
    Public Class MyUserControl
        Inherits UserControl
        Friend WithEvents Webbrowser1 As New WebBrowser With {.Parent = Me, .Dock = DockStyle.Fill}
        Public Sub LoadHTML(html As String)
            WebBrowser1.DocumentText = html
            Webbrowser1.Document.Body.SetAttribute("contentEditable", "false")
        End Sub
    End Class



    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    • Marked as answer by Youen Zen Sunday, July 28, 2013 1:08 PM
    • Unmarked as answer by John M. Andre Monday, July 29, 2013 2:44 AM
    Sunday, July 7, 2013 11:46 AM
  • I just had a VERY strange experience.

    In my code, I changed .Dock to Fill (before it was set to None) and now it works. I change it back to None and it still works fine now.

    There is an issue here but it seems setting the .Dock property to Fill will correct the problem, even if you subsequently change it to something else.

    You can download the sample code which actually causes the problem here.

    Sunday, July 7, 2013 1:16 PM
  • I have unmarked the answer because it DOES NOT actually answer the problem. The problem remains and is very frustrating and VERY reproducible - just follow the link above (my July 7th post) to download the source.

    To say that you can do it a different way does not solve the problem because your way is not available to me. The problem is that with the code posted, the webbrowser control has a major problem when it is hosted on a usercontrol and IE 10 is installed and the .Dock property is not set to fill.

    It would be nice to have a real solution and not someone just marking something as the solution without trying the code I went to the trouble to post.

    Monday, July 29, 2013 2:48 AM

  • It would be nice to have a real solution and not someone just marking something as the solution without trying the code I went to the trouble to post.

    I have failed to reproduce the error following your exact steps more than once. I have gone through the trouble to explain that I am unable to reproduce your error. I believe this error is specific to your system or installation. Here is a screenshot of your error not happening, in 2010 as well.

    Public Class Form1
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            UserControl1.LoadHTML("<html><body>This is a test interesting is it not?</body></html>")
        End Sub
    End Class
    

    Public Class UserControl
        Public Sub LoadHTML(ByVal html As String)
            WebBrowser1.DocumentText = html
    
            Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                Application.DoEvents()
            Loop
    
            WebBrowser1.Document.Body.SetAttribute("contentEditable", "false")
        End Sub
    End Class
    


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Monday, July 29, 2013 3:02 AM
  • With all due respect, the reason why you have not reproduced the error is because you have not downloaded and run the code on a fresh install of Windows 7.

    If you did download the code and run it, as I indicated, you would see the exact problem. The problem has nothing to do with my machine since I can easily reproduce it on ANY fresh install of Windows 7 (testing before and after IE 10 gets installed).

    The problem is VERY reproducible on a clean machine and the code is stripped to the minimum.

    I do wish you would spend the 10 minutes necessary to reproduce the problem before claiming that the problem is not reproducible. Again, with all due respect, it is not that you cannot reproduce the problem, it is that you are unwilling to reproduce the problem (as evidenced by your not running the downloadable code on a fresh Win7 install).

    Monday, July 29, 2013 8:50 AM

  • I do wish you would spend the 10 minutes necessary to reproduce the problem before claiming that the problem is not reproducible. Again, with all due respect, it is not that you cannot reproduce the problem, it is that you are unwilling to reproduce the problem (as evidenced by your not running the downloadable code on a fresh Win7 install).

    See this:

    Steps to reproduce:

     1. Create a new VB.Net project in VS 2010, targetting .Net 3.5
     2. Create a usercontrol <--- this step is the key
     3. Add a webbrowser to the usercontrol
     4. Add this code to the usercontrol

            Public Sub LoadHTML(html As String)
                WebBrowser1.DocumentText = html
        
                Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete
                    Application.DoEvents()
                Loop
        
                WebBrowser1.Document.Body.SetAttribute("contentEditable", "false")
            End Sub

     5. Add that control to a form
     6. Add a button to the form with the following button.Click event:

            Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
                UserControl1.LoadHTML("<html><body>This is a test interesting is it not?</body></html>")
            End Sub

     7. Run the project and click the button
     8. Then, try to double-click the word "interesting" and notice it does not select.

    With all due respect right back to you, your original steps, in your original question have nothing about "installing a fresh copy of windows 7" or downloading anything. Aside from this new demand that you are making, I followed your exact procedure to the T. I was unable to reproduce your problem. 

    I would be willing to further help you, but your nasty attitude needs to go. I am a volunteer and help people from the kindness of my heart, and I don't appreciate the negative reciprocation.

    Moving forward. What is the exact build of windows 7 you are running?


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Monday, July 29, 2013 1:46 PM
  • I do wish you would spend the 10 minutes ...

    This has not been a 10 minute task. So I hope you actually appreciate the effort put into this.

    Following your EXACT procedure:

     1. Create a new VB.Net project in VS 2010, targetting .Net 3.5
     2. Create a usercontrol <--- this step is the key
     3. Add a webbrowser to the usercontrol
     4. Add this code to the usercontrol
                 (See your original post)
     5. Add that control to a form
     6. Add a button to the form with the following button.Click event:

                     (See your original post)

    7. Run the project and click the button
     8. Then, try to double-click the word "interesting" and notice it does not select.

    I produced the following results on the following variations of Windows 7 professional(clean installs, mind you).

    I suggest maybe trying with a different mouse.

    Windows 7 Professional (32bit) With Visual Studio Ultimate 2010:

    • Internet Explorer 8 - Pass
    • Internet Explorer 10 - Pass

    Windows 7 Professional (64bit) With Visual Studio Ultimate 2010:

    • Internet Explorer 8 - Pass
    • Internet Explorer 10 - Pass

    Screenshots(the red area is the client rectangle of the usercontrol to show that the webbrowser is not docked:

    32 Bit


    64 Bit


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.



    • Edited by Paul Ishak Monday, July 29, 2013 9:10 PM edit
    Monday, July 29, 2013 8:42 PM
  • Dear Paul,

    Please do understand that I have meant you no disrespect. I know you offer your time out of the kindness of your heart and I do wish there were more people who would help others.

    I don't believe I have ever said anything negative about your personally...only that you refused to download the code which actually reproduces the problem quite clearly and easily. Nevertheless, I see that Microsoft engineers have dug into the problem from the bug posted here.

    They reproduced the problem and discovered it is an issue with IE 10. Sadly, they also said they would not fix it but they are now aware of it.

    So, I do thank you for your time but it seems there is solution because the problem has been confirmed as part of IE 10.

    Saturday, August 3, 2013 3:57 AM
  • Dear Paul,


    The problem was that even though you had provided a link, I was unable to locate the download link(on the page you linked to), I just looked again, and was able to finally locate it. It was not an unwillingness to download your sample project. Moving on...

    So I looked at your code, and I do see that there is the problem you describe, and I have localized what causes the problem as well. With both of those lines commented out(at the same time), the problem does not occur.

    I have commented out the following two lines that can each cause the problem independent of each other. This code is located in your designer generated code for the form that you are placing the user control on. The trick is that commenting out only one of the lines would not get rid of the problem you describe, as each one of the following commented lines can case the behavior you described, this probably made it a bit difficult for you in localizing the offending line. I will investigate the expected behavior of the webbrowser control based on those properties and let you know if I discover anything else on this issue.

            '
            'WebBrowser1
            '
    
            'Me.WebBrowser1.AllowWebBrowserDrop = False   <--Causes the behavior you describe
            Me.WebBrowser1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
               Or System.Windows.Forms.AnchorStyles.Left) _
               Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
            Me.WebBrowser1.Location = New System.Drawing.Point(3, 3)
            Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
            Me.WebBrowser1.Name = "WebBrowser1"
            'Me.WebBrowser1.ScriptErrorsSuppressed = True <--Causes the behavior you describe
            Me.WebBrowser1.Size = New System.Drawing.Size(516, 270)
            Me.WebBrowser1.TabIndex = 24
            Me.WebBrowser1.WebBrowserShortcutsEnabled = False


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.


    • Edited by Paul Ishak Saturday, August 3, 2013 4:26 AM edit
    Saturday, August 3, 2013 4:25 AM
  • John,

    I also want to let you know that I have sent the following message to my lead at Microsoft, I am hoping they will connect me with the development team, and at the very least we can get a statement regarding this issue. Anyways, take care, I apologize for any mis-communication. When my lead get's back to me, I'll be sure to update you on any relevant information.

    _____________________________________

    Hello ------,

    Is there someone on the Visual Studio/Visual Basic development team that I can directly 

    reach out to concerning an error regarding the WebBrowser control?

    While a webbrowser is on a user control, when either of the following properties: 

    WebBrowser.AllowWebBrowserDrop

    WebBrowser.ScriptErrorsSuppressed

    are set to any of the following values(together or independent of each other):

    True
    False
    Nothing

    The web-browser fails to work correctly.

    The way the the web-browser fails to work is that normally you can double click a word to highlight it.When any of those properties are changed, you can no longer double click a word to highlight it.

    Very Respectfully,

    Paul Ishak



    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Saturday, August 3, 2013 5:02 AM
  • Hi all,

    I can confirm my fellow colleague/contributor Paul's comment in relation to a response from Microsoft that this is indeed a bug and will not be fixed anytime soon. I have a guess that it will be fixed in IE11 which is not far off from being "complete" and will be launched and included in Windows 8.1 which is due to be released this year sometime I believe.

    I was also able to confirm the bug myself. Unfortunately there does not appear to be anything possible at the moment to have a work around of some kind. Since this is not affected on a wider scale in terms of customers, the likelihood of Microsoft releasing a fix for this is extremely slim.

    I will investigate further

    Sorry I could not come with better news,

    Best wishes

    Ahmed Ilyas (C# MVP 2007-2010)


    C# MVP (2007-2010) MS Vendor - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator


    • Edited by ahmedilyas Sunday, August 4, 2013 4:33 PM added investigtion note
    Sunday, August 4, 2013 4:16 PM
  • I have actually just confirmed a workaround. I have not been able to reproduce the error if I modify the two mentioned properties of the webbrowser from the load event of the form that contains the usercontrol.

    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
        'When this first loads, test double clicking of a word in the webbrowser to confirm it works
        'After you have confirmed that you can double click a word,
        'Now uncomment one of the specified lines below and try to double click a word again
        Friend WithEvents TestUserControl1 As New TestUserControl With {.Parent = Me}
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            TestUserControl1.WebBrowser1.AllowWebBrowserDrop = True 'Setting these properties here does not cause the error
            TestUserControl1.WebBrowser1.ScriptErrorsSuppressed = False 'Setting these properties here does not cause the error
            TestUserControl1.WebBrowser1.DocumentText = "<html><body>These are test words that you can attempt to double click</body></html>"
        End Sub
    End Class
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class TestUserControl
        Inherits System.Windows.Forms.UserControl
        Friend WithEvents WebBrowser1 As System.Windows.Forms.WebBrowser
        Private components As System.ComponentModel.IContainer
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then components.Dispose()
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.WebBrowser1 = New System.Windows.Forms.WebBrowser()
            Me.SuspendLayout()
            'WebBrowser1
            'Me.WebBrowser1.AllowWebBrowserDrop = False 'Uncomment this line to test the error(You can set this value to true or false)
            Me.WebBrowser1.Location = New System.Drawing.Point(20, 3)
            Me.WebBrowser1.MinimumSize = New System.Drawing.Size(20, 20)
            Me.WebBrowser1.Name = "WebBrowser1"
            'Me.WebBrowser1.ScriptErrorsSuppressed = True  'Uncomment this line to test the error(You can set this value to true or false)
            Me.WebBrowser1.Size = New System.Drawing.Size(147, 138)
            Me.WebBrowser1.TabIndex = 0
            'TestUserControl
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.Controls.Add(Me.WebBrowser1)
            Me.Name = "TestUserControl"
            Me.Size = New System.Drawing.Size(228, 186)
            Me.ResumeLayout(False)
        End Sub
    End Class


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    • Proposed as answer by ahmedilyas Sunday, August 4, 2013 4:36 PM
    • Unproposed as answer by John M. Andre Wednesday, August 7, 2013 2:43 AM
    • Marked as answer by John M. Andre Wednesday, August 7, 2013 5:20 AM
    Sunday, August 4, 2013 4:35 PM
  • I think it would also be important to mention that it is quite possible that there are other properties that could cause this error(that I have not tested) under the same conditions, so I would imagine that if in a generic sense, you get the same kind of error, then the workaround would be quite similar.

    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Sunday, August 4, 2013 4:44 PM
  • +1 for your determination to solve the problem and finding a work-around :)

    --
    Andrew

    Sunday, August 4, 2013 5:17 PM
  • +1 for your determination to solve the problem and finding a work-around :)

    --
    Andrew

    Thanks Andrew :)

    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Sunday, August 4, 2013 5:18 PM
  • Dear Paul,

    I also appreciate your willingness to continue working on this issue which has been dragging on.

    I took the sample project (VBWinFormsTest.zip) which can be found here (although it is not so obvious where it is on the bug report, it is there after you expand it). Anyway, your fix did not actually fix the issue.

    If you download the sample app and make your changes (comment out those two properties in the designer file and add them back in during the form_load event) you will see the word still does not select when double clicked.

    I think it would help to be working with the same code base (sample code posted on the bug report).

    I also appreciate your request that MS reconsider fixing this.

    Wednesday, August 7, 2013 2:47 AM
  • John,

    Here is a link to your project with the "Workaround" implemented.

    My Skydrive - updateproject.zip


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.


    • Edited by Paul Ishak Wednesday, August 7, 2013 3:55 AM edit
    Wednesday, August 7, 2013 3:51 AM
  • Oh, now I just feel like an idiot. I see that I commented out those properties in the form's designer, not the usercontrol's designer.

    Your solution does fix the problem in the sample project. Great work!

    Sadly my real project still has the problem. It's quite complex so I'll see if I can find out exactly what the strange combination is (it's actually a browser on a usercontrol in a splitter in another splitter, etc, etc - you get the idea) that actually triggers it.

    Anyway, you are a gentleman and a scholar. Thanks again.

    Wednesday, August 7, 2013 5:19 AM
  • Oh, now I just feel like an idiot. I see that I commented out those properties in the form's designer, not the usercontrol's designer.

    Your solution does fix the problem in the sample project. Great work!

    Sadly my real project still has the problem. It's quite complex so I'll see if I can find out exactly what the strange combination is (it's actually a browser on a usercontrol in a splitter in another splitter, etc, etc - you get the idea) that actually triggers it.

    Anyway, you are a gentleman and a scholar. Thanks again.

    You're quite welcome, I just want to reiterate, I really think the main problem is when you use the property grid in design mode to set those properties, and unfortunately, once that code has been generated in the designer file, it doesn't matter if you use the designer to reset the properties back. So I suggest dropping your brand new webbrowser control onto your usercontrol, and then setting any properties you need to modify with code(at least for now, until they fix the problem)...

    You might have to test different places that you can safely set the code. For instance, I didn't test the control's load event, you might be able to set it there, if not, then it would be in the form's event...

    I guess you just kind of gotta get a be creative when searching for a safe place to change the values.

    Anyways I'm glad we were able to find a workaround for you, I hope you can get it implemented into your project soon so your customers can at least be satisfied.

    Take care


    “If you want something you've never had, you need to do something you've never done.”

    Don't forget to mark helpful posts and answers ! Answer an interesting question? Write a new article about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

    Wednesday, August 7, 2013 5:24 AM
  • The WebBrowser control does not play well with other controls, it's needs to be encapsulated (contained within) a Panel, isolated from other form controls.

    I was using the WebBrowser control in a Tab Control and had the same issue.  When adding a Panel within the tab then placing the WebBrowser within the panel, the issue went away.


    Sunday, July 20, 2014 12:47 AM