Components
Form1 As Form
---------------
Button1 As Button
---------------
WV1 As WebView2
---------------
TextBox1 As TextBox
------------------------
Imports Microsoft.Web.WebView2.Core
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WV1.Source = New Uri("https://www.google.com/")
End Sub
Private Sub WV1_NavigationCompleted(sender As Object, e As CoreWebView2NavigationCompletedEventArgs) Handles WV1.NavigationCompleted
Dim task = GetPage2InfoAsync()
End Sub
Private Async Function GetPage2InfoAsync() As Task
Dim DateStr As String
DateStr = Await WV1.ExecuteScriptAsync("document.documentElement.outerHTML")
TextBox1.MaxLength = DateStr.Length + 1000
TextBox1.Text = DateStr
End Function
End Class
One thing I did find out...TextBox is default to 32k length...A lot of page source is like 2 to 3 megs...So I set my TextBox max length to 5000000
I added a line to cure that problem
Under
DateStr = Await WV1.ExecuteScriptAsync("document.documentElement.outerHTML")
I added
TextBox1.MaxLength = DateStr.Length + 1000
That sets the TextBox Length to the Returned Length Plus 1000 Characters.
WebView2control and there seems to be little information around about this but I suspect that it starts here. I think the reason that it's not well documented is that it's part of Chromium.