Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
VB
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:

VB
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
Updated 29-Jan-13 4:10am
v4
Comments
Sergey Alexandrovich Kryukov 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 29-Jan-13 1:06am    
i've updated the question

1 solution

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
 
Share this answer
 
Comments
Bart de Lange 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 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 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 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 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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900