Results 1 to 4 of 4

Thread: [2005] Adding tabbed pages?--PLEASE HELP!

  1. #1

    Thread Starter
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Unhappy [2005] Adding tabbed pages?--PLEASE HELP!

    Hi. I was wondering if there was a way to add a tabpage with controls such as a webbrowser on it but when you fire the event again the controls are still there. Here is my code for the event:

    TabControl1.TabPages.Add(tb)

    tb.Controls.Add(wb)

    wb.Dock = DockStyle.Fill

    wb.Navigate(textbox1.Text)

    TabControl1 is the TabControl, tb is the new tabpage, wb is the new webbrowser, and textbox1 is the url box. When I fire this event twice, the first webbrowser dissapears and the new tabpage has nothing on it. I'm taking a guess that it's a naming problem but I'm wondering if there is another way to address it. am not trying to reparent the web browser. I am trying to create a new web browser for each tabpage but they will all have the same functions as the original such as if you clicked the back button the web browser that you are currently viewing will go back one page, etc. Please HELP! Thanks.

  2. #2
    Member
    Join Date
    Feb 2006
    Posts
    61

    Re: [2005] Adding tabbed pages?--PLEASE HELP!

    i dont think i have to right code for you, i think you can handle this but what you do is make a nw instance of the webbrowser,

    VB Code:
    1. Dim wb As New WebBrowser

    then of course you asign wb its properties and what not.


    then create the tabpage and add wb to it.. make sure to specify size and what not...

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Adding tabbed pages?--PLEASE HELP!

    You should define your own class that inherits TabPage and place the code to add the desired controls in it. You can then create instances of your class and use them wherever TabPage object sare required, so you can create one and add it to a TabControl and the WebBrowser, etc. will be there without additional code.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member sheikh78's Avatar
    Join Date
    Apr 2006
    Location
    C:/
    Posts
    423

    Re: [2005] Adding tabbed pages?--PLEASE HELP!

    I tried the way c0rrupt told me and when I added two tabpages the controls on the tabpages were gone. I think this has to do with the names of the tabpages. Is there anyway to randomly generate a string? - Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width