this is code which opens new window link in same programe

Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
        ' This will be triggered only when link tries to open in new window. 
        ' That means active element in web document will always be a Link.

        Dim myElement As HtmlElement = WebBrowser1.Document.ActiveElement
        Dim target As String = myElement.GetAttribute("href")

        Dim newInstance As New Form1
        newInstance.Show()
        newInstance.WebBrowser1.Navigate(target)

        cancel opening IE window
        e.Cancel = True
    End Sub

Dani AI

Generated

Nice start, — your NewWindow approach handles simple anchor links well. Some pages, however, open popups via JavaScript (window.open) or complex handlers, so the clicked element may not expose a usable href. Two practical options that work more reliably across sites:

  • Use the WebBrowser ActiveX popup event (NewWindow3/NewWindow2). Cast WebBrowser.ActiveXInstance to SHDocVw.WebBrowser, handle NewWindow3 and read the provided URL (bstrUrl) so you can cancel the default and navigate inside your app. This avoids brittle string-parsing of onclick handlers. Example (VB.NET):
Private WithEvents axBrowser As SHDocVw.WebBrowser

Private Sub Form1_Shown(...) Handles Me.Shown
    WebBrowser1.Navigate("about:blank") 'ensure ActiveXInstance is ready
    axBrowser = DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser)
End Sub

Private Sub axBrowser_NewWindow3(ByRef ppDisp As Object, ByRef Cancel As Boolean, _
    ByVal dwFlags As UInteger, ByVal bstrUrlContext As String, ByVal bstrUrl As String) _
    Handles axBrowser.NewWindow3

    Cancel = True
    WebBrowser1.Navigate(bstrUrl)
End Sub

See practical examples and the COM event details for NewWindow3. (CodeProject example) (DWebBrowserEvents2 docs).

If you want the system default browser instead, pointed you in the right direction — launching the URL externally is fine for that use case. Note: the WinForms WebBrowser is IE-based and can run in older document modes; for modern sites consider migrating to WebView2 for better compatibility and security. (WebBrowser overview) (WebView2 docs).

what exactly is the error??

shortcut to start a web page
process.start(link in double quote)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.