none
Creating a Multi tabbed browser using WebBrowser control in C#

    Question

  • Hello Everyone,

    I am creating a web browser using WebBrowser control in C#. I have no idea how to make my browser a multi tabbed one, Can anyone help me with suggestions, advice or anything . I will be very helpful.

    Thanks

    Wednesday, March 23, 2011 5:21 PM

Answers

  • Hi Chaitanya Pandey,

    Its very easy you just need tabbed control. Put browser on tab control.

    Few examples here...

    http://www.codeproject.com/KB/cs/multitabwebbrowser.aspx

    http://www.liewcf.com/build-your-own-tab-browser-using-c-461/

    Thanks,


    Mubi | www.mrmubi.com | Mark The Best Replies As Answers!
    Wednesday, March 23, 2011 5:44 PM
  • The first demonstration is really a complex one which has relatively powerful functions. If it is hard for your to understand. Here you can follow this core idea to try it:
    Create a TabControl to be the whole container which act as the “Web Browser”, add a WebBrowser control to the default tab, if a new tab is needed, append a tab to the TabControl and add a new WebBrowser control to the new tab.

    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 28, 2011 7:44 AM
  • Put a tabControl on your form and button.

    On button click:

    private void button1_Click(object sender, EventArgs e)
        {
          TabPage tb = new TabPage();     
          WebBrowser wb = new WebBrowser();
          wb.Dock = DockStyle.Fill;
          wb.Navigate("www.google.com");
    
          tabControl1.TabPages.Add(tb);
          tb.Controls.Add(wb);
        }
    

    This will automatically generate a new tabPage on you tabControl and navigate to google.

    This should get you started.

    Monday, March 28, 2011 12:37 PM

All replies

  • Hi Chaitanya Pandey,

    Its very easy you just need tabbed control. Put browser on tab control.

    Few examples here...

    http://www.codeproject.com/KB/cs/multitabwebbrowser.aspx

    http://www.liewcf.com/build-your-own-tab-browser-using-c-461/

    Thanks,


    Mubi | www.mrmubi.com | Mark The Best Replies As Answers!
    Wednesday, March 23, 2011 5:44 PM
  • Hi Chaitanya Pandey,

    Its very easy you just need tabbed control. Put browser on tab control.

    Few examples here...

    http://www.codeproject.com/KB/cs/multitabwebbrowser.aspx

    http://www.liewcf.com/build-your-own-tab-browser-using-c-461/

    Thanks,

    Thanks for your reply,

    About the first link: I am using Visual Studio 2010 pro & that project seems to be built a very along time ago & therefore i don't understand the code.

    About the second link: This link has nothing in it!

    I have added TabControl & TabPages & a Add A Tab Button. Whenever user presses that button a new Tab opens but the problem is when i enter a site address it opens only on the tab which was loaded first with the Application.

    Here is my code:

    http://pastebin.com/uTLLDR11

    the problem is in the buttonGO_Click event handler which handles the event of the Go button. Here it is the tab which is opened with the form & only this tab displays content whatever site is typed in whichever tab. How i make this dynamic so that the content opens in the currently selected tab.

    Thanks,

    Wednesday, March 23, 2011 6:03 PM
  • The first demonstration is really a complex one which has relatively powerful functions. If it is hard for your to understand. Here you can follow this core idea to try it:
    Create a TabControl to be the whole container which act as the “Web Browser”, add a WebBrowser control to the default tab, if a new tab is needed, append a tab to the TabControl and add a new WebBrowser control to the new tab.

    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 28, 2011 7:44 AM
  • Put a tabControl on your form and button.

    On button click:

    private void button1_Click(object sender, EventArgs e)
        {
          TabPage tb = new TabPage();     
          WebBrowser wb = new WebBrowser();
          wb.Dock = DockStyle.Fill;
          wb.Navigate("www.google.com");
    
          tabControl1.TabPages.Add(tb);
          tb.Controls.Add(wb);
        }
    

    This will automatically generate a new tabPage on you tabControl and navigate to google.

    This should get you started.

    Monday, March 28, 2011 12:37 PM
  • I've checked your code, I think you could upload your test project for our friends to directly download and reproduce your issue.
    With your given code snippet, even if we can find the criminal, it will take so much time to understand your code and let the UI reappear.
    Or RokoLAB's code may be a point for you to start following.
    Thanks for your understanding.


    Leo Liu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 29, 2011 4:45 AM