PaulPolon
PaulPolon

Reputation: 329

How to Handle/Catch the Link Clicked inside WebBrowser Control in VB.Net 2008

I have a WebBrowser control inside a VB.Net 2008 application.

When I click a link inside the WebBrowser, it opens a new Internet Explorer Window. I do not handle the web page so I cannot in any way modify the Target property.

Is there a way in VB.Net to catch the Clicked Link and have it display inside the particular WebBrowser Control?

Upvotes: 1

Views: 206

Answers (1)

Anshuman Chatterjee
Anshuman Chatterjee

Reputation: 962

Try this:

private void myWebBrowser_NewWindow(object sender, System.ComponentModel.CancelEventArgs e)
{
    e.Cancel = true;
    myWebBrowser.Navigate(myWebBrowser.StatusText);
}

Upvotes: 1

Related Questions