locked
VB.NET: Web Browser New Window In Tab Control WebBrowserNewWindow Error RRS feed

  • Question

  • I am making a web browser for a Kiosk system that uses a tab control to display web pages, the user can add and remove tabs.  When a new tab is created it creates a new web browser using:

    Dim newbrowser As New WebBrowser
    

    In the AddWebTab private sub, which is called when the users adds a tab.

    I have also added some handlers:

    AddHandler newbrowser.DocumentCompleted, AddressOf browserloaded
    AddHandler newbrowser.NewWindow, AddressOf WebBrowserNewWindow
    

    The problem is on the newbrowser.NewWindow handler I get an error at WebBowserNewWindow, where the code is underlined in blue and when I hover over it I get the message: Name "WebBrowserNewWindow" is not declaired.

    I don't recieve this problem for the newbrowser.DocumentCompleted handdler.

    The private sub that I want to call is:

    Private Sub WebBrowser_NewWindows(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowser)
    
    End Sub
    

    Could someone please help?

    Thanks
    Aaron


    • Edited by AaronMcH Monday, December 12, 2011 7:39 PM The title needed more info
    • Moved by Rich Prescott Monday, December 12, 2011 7:57 PM VB.NET ? (Moved from: Scripting Guys forum) (From:The Official Scripting Guys Forum!)
    Monday, December 12, 2011 7:38 PM

Answers

All replies

  • You are in the wrong forum.  THis is a scripting forum and your question is a developer issue.  Please post this in the appropriate developer forum.

     


    jv
    Monday, December 12, 2011 8:06 PM
  • I don't see any other appropriate forum category.

    Aaron

    Monday, December 12, 2011 8:11 PM
  • Where did you look?

     


    jv
    Monday, December 12, 2011 8:17 PM
    • Edited by jrv Monday, December 12, 2011 8:22 PM
    Monday, December 12, 2011 8:18 PM
  • Sorry, I can't access that :(!

    Aaron

    Monday, December 12, 2011 8:22 PM
  • Here try this to see why you cannot do what you are trying to do.

    public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                webBrowser1.NewWindow += WebBrowser1_NewWindow;
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
    
                webBrowser1.Navigate(@"http:\\www.google.com");
                webBrowser1.
    
            }
            private void WebBrowser1_NewWindow(Object sender, CancelEventArgs e)
            {
    
                System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
                messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel);
                messageBoxCS.AppendLine();
                MessageBox.Show(messageBoxCS.ToString(), "NewWindow Event");
            }
    
        }
    }
    
    

     

    It is in C# but shows how teh WebBrowser control is intended to be used.  It does not support tabed windows and will not make a good Kiosk.  You are mixing the Web Browser control which is used in Forms with the Web Browser itself.

    A Web browser is craed like this:

    Set is - CreateObject("IntrernetExplorer.Application") or the equivalent in VB, VB.NET or C#.

    Only the full browser supports tabs.

     

     


    jv
    Monday, December 12, 2011 8:57 PM
  • Sorry, I can't access that :(!

    Aaron


    WHat? Anybody can access this:

    http://social.msdn.microsoft.com/Forums/en-US/vblanguage/threads


    jv
    Monday, December 12, 2011 9:43 PM
  • I can now, weird, is there a way to just move this to that forum or do I have to recreate it?

    Thanks
    Aaron

    Monday, December 12, 2011 11:23 PM
  • I can now, weird, is there a way to just move this to that forum or do I have to recreate it?

    Thanks
    Aaron

    I can move it there if you want. But typically this forum is just about telling you where to go to ask questions.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Friday, April 13, 2012 3:28 PM