How to use new WebBrowserControl in .Net 5

john zyd 421 Reputation points
2021-02-11T21:32:47.51+00:00

Hello:
I found there seem to be a new version of WebBrowserControl for .NET 5 Window Form, check this URL: I believe it is a new one for Chrome based browser, not the old one for IE.
https://video2.skills-academy.com/en-us/dotnet/api/system.windows.forms.webbrowser?view=net-5.0
But I can’t find any code sample for this.
I want to do the following simple thing:
I want to launch Edge (Chrome) browser to visit https://www.bing.com/
Then in the input box, input “webbrowsercontrol .net 5”
Then click the search icon.

Can someone share some code samples to carry out the above simple steps.
My IDE: Visual Studio 2019 Version 16.8.5 on Windows 10 (Version 20H2)
By the way, what is the difference between this WebBrowserControl and WebView2? Can WebBrowserControl run JavaScript directly or not?
Thanks,

Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
966 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
337 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sam of Simple Samples 5,526 Reputation points
    2021-02-11T23:09:21.113+00:00

    That page does not state explicitly that the WebBrowserControl uses IE but if you search that page for Internet Explorer you will see that it does. So that is what the WebView2 control is for; it supports Edge instead of IE.

    Use of the WebView2 control involves more than sample code; you need to also install the WebView2 SDK using NuGet. See Getting started with WebView2 for WinForms apps - Microsoft Edge Development | Microsoft Learn for full instructions and sample code.

    0 comments No comments

0 additional answers

Sort by: Most helpful