New Window

i am making a browser in vb 2005 beta but sometimes when i click a link it opens in a new window in Internet Explorer now how can i have it so it opens in a new version of my own browser or a browser on a second form

any help would be greatly apreciated.



Answer this question

New Window

  • Matthewsnape

    ok im kinda new to this all so how whould i do that in vb 2005 beta 2 since the old way in vb 6 wont work anymore
  • Analyst

    Just to be clear, you used the extended NewWindow event, grabbed the Url it was going to open, cancelled the event, and then launched a new instance of your browser application passing in the Url


  • Elizabeth Maher

    Ok this works great now indeed the problem is with the javascript , i removed messagebox.show because it's not really needed now is there a possibility around the status text that pops up with javascipt links and how can i set it that with the right mouse button click open in new window it will acutlly open in lets say form4 and the browser on that form i hope you understand what im trying to do here.
  • wavuti

    This is the code im using now and it doesnt work it still opens IE in a new instead of using my own browser screen

    Private Sub WebBrowser1_NewWindow2(ByVal ppDisp As Object, ByVal Cancel As Boolean)

    Cancel = True

    End Sub


  • DotNET_Guru

    I already tried that but it didn't work for me as it started opening in IE again. Do you have another solution to just close the screen that popups saying there is a javascript blah blah blah. It would be good enough if it would simply automaticly close that screen.
  • Flavio Roberto

    Hi,


    You could try handling the NewWindow event of the webbrowser control...





    cheers,



    Paul June A. Domag

  • AlexisP

    This looks like VB6 code.  Here is what the .NET code should look like, assuming the webbrowser control is named WebBrowser1...

        Private Sub WebBrowser1_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
            MessageBox.Show("NewWindow event.")
            e.Cancel = True
            WebBrowser1.Navigate(WebBrowser1.StatusText)

        End Sub

    The trick is, the event args don't provide the Uri to which the new window is navigating, so you can cancel the NewWindow, but then what   I used the StatusText in this snippet.  When you mouse over links, the StatusText contains the href for the link.  I wouldn't rely on this, however, because this won't work for javascript Open client-side script. 


  • rajas

    i used everything it said there, but are you saying i only should use a part of the code

    Another option for me would be like i said an option close the popup warning automaticly.


  • YaliWei

    Hi,


    To add a Event in a control, select the control, goto properties window, press the lightning button on the top. That will list the available events in the control...
    Just DoubleClick on the textbox to add a defaultname event, or you could simply specify one...






    cheers,


    Paul June A. Domag

  • Anthony Yott

    So what if you use the entire code on that site, does it then still not work on your particular computer

  • mrjoeclark

    Look here for details: http://forums.microsoft.com/msdn/ShowPost.aspx PostID=7228

    What you need is an extended NewWindow event, that provides the Url.  This post contains code to do that.

  • TishaL

    Hi,


    Could you try posting the code
    Coz vb6 code normally wouldn't run on vb.net there are some conversions to be done...




    cheers,



    Paul June A. Domag

  • wpf314

    that is what i did i tried everything and nothing
  • KSH

    Ok so far i have accomplished that but i mean the code used for VB6 wont work, it doesnt stop IE from opening in a new window
  • New Window