Using WebView2 with Visual Basic .NET (2017+)

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 31

  • @robytube666
    @robytube666 2 ปีที่แล้ว

    saved my life. Thank you

  • @pietrohenriquericardo827
    @pietrohenriquericardo827 3 ปีที่แล้ว +3

    Good Jobs man ! Form1.WebView2.Source = New Uri("your https here") No error " System.NullReferenceException: 'Object reference not set to an instance of an object.'" the code is perfect

  • @martinschaferle
    @martinschaferle 7 หลายเดือนก่อน

    I copied the .exe and the 3 dll files to another device, but unfortunately, the Webview2 doesn't work there. What could be the reason for this? The 'MicrosoftEdgeWebview2Setup' installation is already installed. 😕

    • @g2gnet
      @g2gnet  7 หลายเดือนก่อน +1

      When distributing your application, there are a few ways you can ensure the WebView2 Runtime is on client machines. For client machine please select download Evergreen Standalone Installer x86 or x64. developer.microsoft.com/en-us/microsoft-edge/webview2

  • @DiyintheGhetto
    @DiyintheGhetto 2 ปีที่แล้ว

    Hello, How can I disable right click on webview2 and disable from using the ALT key in the browser?

    • @g2gnet
      @g2gnet  2 ปีที่แล้ว

      Private Sub WebView21_CoreWebView2Ready(sender As Object, e As EventArgs) Handles WebView21.CoreWebView2Ready
      WebView21.CoreWebView2.Settings.AreDefaultContextMenusEnabled = False
      End Sub

  • @feeldulfo9387
    @feeldulfo9387 9 หลายเดือนก่อน

    I have build and deploy the project it's not working on me, did you also try to deploy this kind of project?

  • @windows-ubuntu1604
    @windows-ubuntu1604 2 ปีที่แล้ว

    Omg thank you!!!

  • @imranbhatti8580
    @imranbhatti8580 2 ปีที่แล้ว

    Any chance to access webview2 control for a VBA userform?

  • @thomasd.8831
    @thomasd.8831 4 ปีที่แล้ว +1

    Im doing exactly the same as you but it doesnt work.

    • @g2gnet
      @g2gnet  3 ปีที่แล้ว

      You can download source code @here ... github.com/thongkorn/WebView2

  • @shubhamshrimali2337
    @shubhamshrimali2337 3 ปีที่แล้ว

    I am not able to use Asc in my case why is that?? please reply me asap I am in urgent need of it

    • @g2gnet
      @g2gnet  3 ปีที่แล้ว

      You can download source code @here ... github.com/thongkorn/WebView2

  • @jbradshaw7
    @jbradshaw7 4 ปีที่แล้ว

    How to distribute? Doesn't just happen.

    • @g2gnet
      @g2gnet  4 ปีที่แล้ว

      If you want to implement it, just use the EXE file and 2 DLL Files are Microsoft.Web.WebView2.WinForms.dll and Microsoft.Web.WebView2.Core.dll. (Please see at BIN Directory)

  • @Hafturlaub
    @Hafturlaub 3 ปีที่แล้ว

    Thanks!

  • @jarno2427
    @jarno2427 3 ปีที่แล้ว

    Can you make a c# tutorial with webview 2 amd easytabs please

    • @g2gnet
      @g2gnet  3 ปีที่แล้ว

      Sorry, but I'm good only visual basic language.

    • @jarno2427
      @jarno2427 3 ปีที่แล้ว

      @@g2gnet okay

    • @jarno2427
      @jarno2427 3 ปีที่แล้ว

      @@g2gnet maybe in can help little bit with my code as start maybe if you want that

    • @jarno2427
      @jarno2427 3 ปีที่แล้ว

      @@g2gnet ublic frmBrowser()
      {
      InitializeComponent();
      webView21.NavigationStarting += EnsureHttps;
      InitializeAsync();
      }
      void EnsureHttps(object sender, CoreWebView2NavigationStartingEventArgs args)
      {
      String uri = args.Uri;
      if (!uri.StartsWith(""))
      {
      webView21.CoreWebView2.ExecuteScriptAsync($"alert('{uri} may not be safe, try an https link')");
      args.Cancel = true;
      txtUrl.IconLeft = Properties.Resources.delete_shield_40px;
      }
      else
      {
      txtUrl.IconLeft = Properties.Resources.shield_48px;
      }
      }
      private async void frmBrowser_Load(object sender, EventArgs e)
      {
      panel2.Visible = false;
      panel2.Enabled = false;
      }
      protected TitleBarTabs ParentTabs
      {
      get
      {
      return (ParentForm as TitleBarTabs);
      }
      }
      private void btnRefresh_Click(object sender, EventArgs e)
      {
      webView21.Reload();
      }
      private void btnGo_Click(object sender, EventArgs e)
      {
      if (webView21 != null && webView21.CoreWebView2 != null)
      {
      webView21.CoreWebView2.Navigate(txtUrl.Text);
      }
      }
      private void txtUrl_KeyPress(object sender, KeyPressEventArgs e)
      {
      }
      async void InitializeAsync()
      {
      await webView21.EnsureCoreWebView2Async(null);
      webView21.CoreWebView2.WebMessageReceived += UpdateAddressBar;
      await webView21.CoreWebView2.AddScriptToExecuteOnDocumentCreatedAsync("window.chrome.webview.postMessage(window.document.URL);");
      }
      void UpdateAddressBar(object sender, CoreWebView2WebMessageReceivedEventArgs args)
      {
      String uri = args.TryGetWebMessageAsString();
      txtUrl.Text = uri;
      webView21.CoreWebView2.PostWebMessageAsString(uri);
      }
      private void txtUrl_KeyUp(object sender, KeyEventArgs e)
      {
      if (e.KeyCode == Keys.Enter && txtUrl.Text.Trim().Length > 0)
      {
      //detect url
      if (txtUrl.Text.Contains("."))
      {
      //ites a url
      webView21.CoreWebView2.Navigate(txtUrl.Text.Trim());
      }
      else
      {
      //its a search
      webView21.CoreWebView2.Navigate("www.google.com/search?client=opera&q=" + txtUrl.Text.Trim().Replace(" ", "+") + "&sourceid=opera&ie=UTF-8&oe=UTF-8");
      }
      }
      }
      private void btnBack_Click(object sender, EventArgs e)
      {
      webView21.GoBack();
      }
      private void btnForward_Click(object sender, EventArgs e)
      {
      webView21.GoForward();
      }
      private void btnMenu_Click(object sender, EventArgs e)
      {
      panel2.Visible = true;
      panel2.Enabled = true;
      }
      private void btnClose_Click_1(object sender, EventArgs e)
      {
      panel2.Visible = false;
      panel2.Enabled = false;
      }
      private void btnSettings_Click(object sender, EventArgs e)
      {
      Settings st = new Settings();
      st.ShowDialog();
      }
      }
      mainform

  • @rkworldyoutube
    @rkworldyoutube 7 หลายเดือนก่อน

    Many many thanks
    Please make a video how to export it in exe and install on other computers

    • @YaBoiKTP
      @YaBoiKTP 26 วันที่ผ่านมา

      Id Recommend just get all the files from the bin Creating A Head Folder Pasting Them Creating A Shortcut To The EXE And Then Put It In a Zip folder To Share/Extract

  • @deekshithkajenaik5779
    @deekshithkajenaik5779 3 ปีที่แล้ว

    It dosent working...

    • @g2gnet
      @g2gnet  3 ปีที่แล้ว

      You can download source code @here ... github.com/thongkorn/WebView2

  • @natalalbertonatal5948
    @natalalbertonatal5948 4 ปีที่แล้ว

    you should let all your project to us make download

    • @g2gnet
      @g2gnet  4 ปีที่แล้ว

      This video clip you can definitely do simple projects without source code from me.

  • @ศิริเหินเวหาพัฒนาสู่ภูมิแผ่นดิ

    ขอเฟส บุ๊คได้มั้ยครับ อยากเรียน เวริคช็อป พอดีผมเขียน แต่ vba ใน excel อยากลอง ตรงนี้บ้างครับ

    • @g2gnet
      @g2gnet  3 ปีที่แล้ว

      facebook.com/g2gnet

  • @philg4116
    @philg4116 2 ปีที่แล้ว

    That’s really shitty rock music, thus royalty-free public domain.

    • @kenmattern2596
      @kenmattern2596 ปีที่แล้ว

      It would be much better if you actually narrated what you are doing. Just music that sounds like it was stolen from DOOM 1 with no explanation is not helpful