user2221877
user2221877

Reputation: 35

How to see if any link in WebBrowser contains string? VB.NET

I am building a web browser and if a link is clicked, if that link contains a certain string then I want a different program to open:

Private Sub WebBrowser1_Navigated(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
If WebBrowser1.Document.Links.Contains("STRING") Then
        Process.Start("PROGRAM I WANT TO OPEN")
End If
End Sub

Upvotes: 0

Views: 739

Answers (1)

Josh Weston
Josh Weston

Reputation: 1900

Try using

If InStr(e.Url.ToString, "String") Then
   Process.Start("Program I want to open")
End if

Upvotes: 1

Related Questions