Results 1 to 7 of 7

Thread: [RESOLVED] Webscrapping issue with toolbar buttons, program appears to freeze

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    392

    Resolved [RESOLVED] Webscrapping issue with toolbar buttons, program appears to freeze

    Not expecting resolution, but simply ideas to my issue.

    I'm webscraping using VB Net Webbrowser1 module in VS 2022. My issue is that when I click on a menu button, except another menu on the toolbar, the program freezes. The scrapping works just fine until I try to manipulate one of the buttons, except the menu button, that the program starts to work as the "Processing" bar appears but then that's it. This is also the same whether I manually press the buttons, instead of through code.

    Any idea's I can chase after for something like this? I have full control over the company portal web page that we need for automating old records, but this one issue is killing me. I have the same program being transported over to VB written in VBA. When the IE is running with Excel there are no issues and everything runs along like a purring cat. However, when I run in VB the program hangs when I press/onclick these particular toolbar buttons.

    I'm wondering if it is actually Webbrowser1 which is my issue.

    Any avenue to chase would be very helpful.

    EDIT: If I select a new record to process when the page appears to be frozen, then the webpage will react and do what it's told. So the page is not really frozen, but just won't process the command coming from the toolbar.

    I never receive a signal from the handler to move on to the next step.
    Last edited by FunkMonkey; Sep 23rd, 2025 at 09:19 PM.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    It is very likely that this is a WebBrowser issue because the control is basically a wrapper around Internet Explorer and to make things worse (because IE is absolute crap), it emulates IE7. You can confirm the version by running this JavaScript on the web page through the WebBrowser:
    Code:
    console.log(document.documentMode)
    I'm almost willing to bet that is the reason your web page is crashing.

    The way that you can confirm that this is an issue with the version of IE that the browser is emulating is to force the WebBrowser to emulate a later version (like IE11). Here is a way of doing it for current user's registry:
    Code:
    Imports Microsoft.VisualBasic.ApplicationServices
    Imports Microsoft.Win32
    Imports System.IO
    
    Namespace My
    
        Partial Friend Class MyApplication
    
            Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
                SetInternetExplorerEmulationToIE11()
            End Sub
    
            Private Shared Sub SetInternetExplorerEmulationToIE11()
                Dim appName As String = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName)
                Dim regPath As String = "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
                Using key As RegistryKey = Registry.CurrentUser.CreateSubKey(regPath)
                    If key IsNot Nothing Then
                        key.SetValue(appName, 11000, RegistryValueKind.DWord)
                    End If
                End Using
            End Sub
    
        End Class
    
    End Namespace
    If that works, then you know its because IE sucks and should have been abandoned about 5 years before IE7 and you also have a work around.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    392

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    I hate to sound like an idiot, but VB is not my normal operating software, VBA is, though similar in some instances they are completely different.

    So for the second set of code.... Not sure how I handle "Namespace". Do I place it directly in the class, or does it go outside of the class to run?

  4. #4
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    To be honest, you don't even need to run that in VB.NET, just modify the registry yourself:
    1. Use shortcut Win+R
    2. Enter: regedit
    3. Click OK
    4. From the left-hand window, go to: Computer\HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
    5. Click on Edit > New > DWORD (32-bit value)
    6. Name it whatever your executable is named
    7. Select the record and then click on Edit > Modify
    8. Set the value to 11000


    But if you did want to do this through VB.NET:
    1. Click on Project > {Project Name} Properties
    2. From the Application Tab, click on the View Application Events button
    3. Replace everything with the code I gave you in #2
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    392

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    Thanks dday. I placed the code you gave on the outside of the class. It seemed to run, as I put a breakpoint there and it ran the code. This did not help though.

    The code runs before the main code and the results did not change. The window still appears to freeze, never gives the handle a fire command, and sits there. I can, as stated before, execute the next record and that works from the beginning of the process.

    Just seems to be something with that toolbar and IE. I'll keep playing with it, but I'm close to saying that I can't win.

    Thanks for the information.

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    Can you confirm if the registry was added by following steps 1-4 and confirming if your executable shows up in that list?

    If it does, then you can rule out potential IE version issues (which would completely surprise me).
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    392

    Re: Webscrapping issue with toolbar buttons, program appears to freeze

    It's there..... Looks like a company portal issue. Bummer too because I just built up a better program in VB then VBA for what we need in record processing.

    "EPIQ Interface.exe"

    Thanks so much for your assistance and the information.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width