Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
 
i've made an web browser with tabs
now what i want is a new tab button that inserts another tab page before that button
i know you can do this with this code
Me.customtabcontrol1.TabPages.Insert(Me.customtabcontrol1.TabCount - 1, "Newtab" & Me.customtabcontrol1.TabCount, "New")
but i've got tabpages that contain another Form2.vb as a control
do you have any ideas how i can fix it so it inserts the tabpage with the form2.vb before the tabpage i use as a "button"
 
this is the code i use to add a tab:
 
        Dim t As New TabPage
        Dim newtab As New tab
        newtab.Show()
        newtab.WebKitBrowser2.Navigate(url)
        newtab.TopLevel = False
        newtab.Dock = DockStyle.Fill
        customtabcontrol1.Dock = DockStyle.Fill
        customtabcontrol1.ContextMenuStrip = ContextMenuStrip1
        t.Controls.Add(newtab)
        customtabcontrol1.Controls.Add(t)
 
best regards,
Bart de Lange
Posted 28-Jan-13 8:06am
Edited 29-Jan-13 4:10am
v4
Comments
Sergey Alexandrovich Kryukov at 28-Jan-13 19:27pm
   
The question is easy, but... You need to tag your UI library you use. Forms? WPF? something else? [EDIT] OK, from the context, I can see it's Forms, but... it's not good for you if you don't tag it. You need people to see what is your topic before even opening this page. —SA
Bart de Lange at 29-Jan-13 1:06am
   
i've updated the question

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Never ever use a form as a child control of some other control. Use something like a Panel.
 
You already know how to insert a tab page. In most cases, you also need to show the newly created tab page. For this purpose use one of these properties:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpages.aspx[^].
 
—SA
  Permalink  
Comments
Bart de Lange at 29-Jan-13 1:06am
   
To use a panel is no option because my child form contains a webkit browser a searchbar back button and a lot more so that's to much to design with code for me and the others are also no option i could send you a picture if i'd know how to do that
Sergey Alexandrovich Kryukov at 29-Jan-13 1:29am
   
Wrong. Using a child window is not an option. More exactly, you can force it to be a child by setting TopLevel to false, but... nothing good. Your reply is just wrong. Everything you can put in the form, you can put in Panel or immediately in WebPage. I mean it: absolutely everything. Just do it (copy-paste under Designer, for this matter), and then you will see. Not need to send a picture; this matter is fully obvious. —SA
Bart de Lange at 29-Jan-13 1:42am
   
I dont know what you mean I have this (Form1 ) (Tabcontrol) ((Tab.vb. )) The tab.vb is created as control in runtime Because it contains events and the disign to imitate a google Chrome kind of webbrowser This is the vid i used for the disign http://www.youtube.com/watch?v=z_xA9AGet_U So how do i do that
Sergey Alexandrovich Kryukov at 29-Jan-13 1:44am
   
Do what?! In your diagram, you are mixing up a control and a file. How can I talk with you. You need to do what I told you; if you don't understand it, explain what. —SA
Bart de Lange at 29-Jan-13 1:48am
   
Look the vid i send u a couple of minutes/parts then you see what i'm trying to manage
Sergey Alexandrovich Kryukov at 29-Jan-13 2:13am
   
15 minutes! Are you serious? Just stop it. —SA
Bart de Lange at 29-Jan-13 2:34am
   
Pic better ????
Sergey Alexandrovich Kryukov at 29-Jan-13 2:44am
   
That's why you probably have some problem with programming, which is an art to express everything in words... :-) —SA
Bart de Lange at 29-Jan-13 4:21am
   
When i can i sent you one, how do i do that??
Bart de Lange at 29-Jan-13 6:41am
   
You know how chrome looks like??? Im trying to imitate that with 2 forms one with only the tabcontrol(form1.vb) And the other containing the url bar, back button, forward, search, openwebkitsharp webkitbrowser, a favorits bar and a settings bar(tab.vb). Ive done it that way because its easyer for me to handle the events and such Now i want to create a tabpage that functions as a button So that it creates a new tab before the "button" How do i do that. I dont understand how to do it with a pannel I hope ive explained it better this way
Bart de Lange at 29-Jan-13 6:45am
   
When im back from school i'l send you the code for the newtab i use

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 690
1 Dnyaneshwar@Pune 540
2 ravikhoda 325
3 OriginalGriff 279
4 Manas Bhardwaj 230
0 Sergey Alexandrovich Kryukov 10,974
1 OriginalGriff 6,777
2 Peter Leow 4,785
3 Abhinav S 3,813
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid