dcsimg
Results 1 to 5 of 5

Thread: VB Forms WebBrowser1 Bug trying to figure out

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    2

    Question VB Forms WebBrowser1 Bug trying to figure out

    Hello guys sorry if this is the wrong section for this, I have issue with my web forms, As im new in VB thought you could know what could be an issue. This is a small college project i'm doing with my mate.
    ISSUE: It squishes website and doesn't function properly.
    This is how it should look:
    Name:  ok1.jpg
Views: 128
Size:  18.7 KB

    Name:  ok2.jpg
Views: 125
Size:  27.1 KB

    This is how it opens in application:
    1
    Name:  1.jpg
Views: 128
Size:  19.8 KB
    2
    Name:  2.jpg
Views: 125
Size:  14.0 KB

    My code:
    Code:
    Imports System.IO
    
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.WindowState = FormWindowState.Maximized
            WebBrowser1.ScriptErrorsSuppressed = True
            WebBrowser1.Navigate("https://amapshopping.**********app.com/")
        End Sub
    
        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            WebBrowser1.Navigate("https://amapshopping.**********app.com")
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    
        End Sub
    
        Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
    
        End Sub
    
        Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
    
        End Sub
    
        Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
    
        End Sub
    
        Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    
        End Sub
    
        Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
            WebBrowser1.Navigate("www.bbc.co.uk")
        End Sub
    
        Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
    
        End Sub
    
        Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
            WebBrowser1.Navigate("www.amazon.co.uk")
        End Sub
    
        Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
            Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) + Path.DirectorySeparatorChar + "osk.exe")
        End Sub
    End Class
    I already have tried multiple tutorials but nothing doesn't seem to help, opened website manually trough IE,EDGE,CHROME everything opens fine but when i open it thought application it just breaks like this, any advice?

    Thank you in advance.

  2. #2
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,133

    Re: VB Forms WebBrowser1 Bug trying to figure out

    By default the Webbrowser control is using an older version of IE (I think its IE7 if I remember right), and the last version of IE was IE11. I had a tutorial on upgrading the control to the version installed, but it seems to be broken or so reported as such. http://www.vbforums.com/showthread.p...rowser-Control

    Have you tried using another Browser control? There are a couple others to choose from Gecko, and CefSharp. All pretty well have the same concepts as the webbrowser control, but a little more updated, and less likely to have
    those issues.
    Disclaimer: When code is given for example - it is merely a example.
    See my browser project BeffsBrowser
    Try my new Browser project LightBrowse "A Browser and not much else" Screen Capture with Imgur API


    Unless said otherwise (e.g. From one of my projects thus, those are mostly licensed under MIT) - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2019
    Posts
    2

    Re: VB Forms WebBrowser1 Bug trying to figure out

    Hello jdc, Thanks for replying to my post, Could you please give me more information about This topic maybe some you tube video, becouse ones i looked at was complete

  4. #4
    Frenzied Member jdc20181's Avatar
    Join Date
    Oct 2015
    Location
    Indiana
    Posts
    1,133

    Re: VB Forms WebBrowser1 Bug trying to figure out

    What do you mean? There is two solutions: Force Upgrade to the newest available version of IE on the User's machine or use an alternative browser control. Looks like it posted before you could finish.

    To install Gecko: Use 32-bit https://www.nuget.org/packages/Geckofx60.32/ or 64-bit https://www.nuget.org/packages/Geckofx60.64/

    Install the nuget package, in VS and then you can get started by using the example below.
    Code:
    Import Gecko 
    Public Class Form1 
     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'Initialize Gecko - if this is called before the adding of the control it will fail. 
       Xpcom.Initialize("Firefox")
     Dim brws As New GeckoWebBrowser With {
                    .Dock = DockStyle.Fill
                }
    brws.navigate("https://google.com")
    'Add some compatibility by adjusting the user agent string
     Dim sUserAgent As String = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/66.0" 
    '^^^ NOTE: While this says FireFox66 we are only making webpages THINK this, it is NOT changing the version realistically. 
    
                GeckoPreferences.User("general.useragent.override") = sUserAgent
              
                GeckoPreferences.Default("general.useragent.override") = sUserAgent
    Disclaimer: When code is given for example - it is merely a example.
    See my browser project BeffsBrowser
    Try my new Browser project LightBrowse "A Browser and not much else" Screen Capture with Imgur API


    Unless said otherwise (e.g. From one of my projects thus, those are mostly licensed under MIT) - All Code snippets advice or otherwise that I post on this site, are expressly licensed under Creative Commons Attribution 4.0 International Please respect my copyrights.

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,261

    Re: VB Forms WebBrowser1 Bug trying to figure out

    As JDC noted, there's two soutions... the first one is to continue to use the WebBrowser control in VB, but change a registry setting to force it to "upgrade" itself ... it's kind of a weird thing, but here's the skinny on it, since I'm not sue the other thread goes into it ... back in the day, the web browser control was added to VB... somewhere around the time IE6 was released. People started using it. Then IE7 was released and since the browser was tied to it, it "upgraded" ... well there were some changes to the engine around that time hat broke some people's IE6-based coded sites they were using in their apps... so they had to be re-done to work with IE7.... so MS (in their infinite wisdom) decided, OK, we'll continue to upgrade the engine, but the browser control will be "frozen" to the IE7 version of it. There will be a way to unlock and upgrade it to newer versions of the engine, and we'll make it a registry setting (because everyone loves the registry) and we'll make the documentation on it difficult,and we won't really mention anything about it, because if it's hard to write, it should be hard to use.

    This is why a lot of people think that the web browser is broken or some how doesn't work or there's something wrong with newer sites.... because the rendering engin that the WB defaults to is nearly 20 years old and can't handle newer sites. But that can be remedied with a registry setting and changing it to the latest version the user has installed.

    Meanwhile, MS has released the Edge Browser... and then since that announced that the Edge Browser will begin using Chromium as its engine.... so take it for what it's worth.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width