An object-oriented programming language developed by Microsoft that can be used in .NET.
Hi,
using WebBrowser you must wait for document ready. Try following console demo:
Imports System.IO
Imports System.Windows.Forms
Module Module87
Sub Main()
Try
Call (New Demo).Execute()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
Console.WriteLine("Continue enter key")
Console.ReadKey()
End Sub
Friend Class Demo
Friend Sub Execute()
Dim ApplicationDirectory = Path.GetDirectoryName(Application.ExecutablePath)
Dim myFile = Path.Combine(ApplicationDirectory, "Module87.html")
Dim ret = GetTitleForUri(New Uri("file:///" & myFile))
Console.WriteLine(ret)
End Sub
End Class
Function GetTitleForUri(input As Uri) As String
Using wb As New WebBrowser
wb.Navigate(input)
While (wb.ReadyState <> WebBrowserReadyState.Complete)
Application.DoEvents()
End While
Return wb.Document?.Title
End Using
End Function
End Module