TabControl help :/

oriax123

Member
Joined
Jul 14, 2012
Messages
8
Programming Experience
Beginner
First off i want to say sorry if this is the wrong section.



Ive been trying to get any tabcontrol to work with the browser im making, (ive searched for several days and tried alternate methods with no dice)

Where im trying to open a form into a tab (Ive tried QTabControl, MdiTabControl, CustomTabControl,SuperTabControl, ect...)


heres the code for form1

Code:
Imports System.IO
Imports System.Net
Imports DevComponents.DotNetBar
Imports WebKit
Imports Qios.DevSuite.Components


Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Creates aero effects
        Dim glass As New rtaGlassEffectsLib.rtaGlassEffect
        glass.TopBarSize = 30
        glass.ShowEffect(Me)

        Dim newtab As New TabPage             
        Dim tabs As New SearchForm              'name of the form im trying to put into the new tab
        tabs.Show()                                     
        tabs.TopLevel = False                       
        tabs.Text = "New Tab"
        t.Controls.Add(tabs)
        tabs.Dock = DockStyle.Fill
        TabControl2.Controls.Add(t)

       
    End Sub

    Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'Process1 goes here to start
        Process1.Start()
        Close()
    End Sub

    Private Sub TabControl2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class

How can i get it to show the form "SearchForm" into a tab in "Form1"? Any help will be awesome!

Ps. Im trying to use anything but the TabControl that comes with Visual Basic. Reason, i want to change the tab features/design.
 

Herman

Well-known member
Joined
Oct 18, 2011
Messages
882
Location
Montreal, QC, CA
Programming Experience
10+
What is a SearchForm? If it's derived from Form, you cannot open a form in a TabPage. Take whatever is on the form and stick it into a container object like a GroupBox, or a Panel, and open that in your TabPage.
 

oriax123

Member
Joined
Jul 14, 2012
Messages
8
Programming Experience
Beginner
What is a SearchForm? If it's derived from Form, you cannot open a form in a TabPage. Take whatever is on the form and stick it into a container object like a GroupBox, or a Panel, and open that in your TabPage.
The SearchForm is a form with borderstyle set to none and it has like the toolbar, textbox to search, buttons, webkitbrowser ect.

Im trying to do this How To Make A Tabbed Web Browser In Visual Basic 2008 2010 VB - YouTube but with a different TabControl.

Im trying to make a webBrowser like chrome if that helps
 

Herman

Well-known member
Joined
Oct 18, 2011
Messages
882
Location
Montreal, QC, CA
Programming Experience
10+
Parenting a form isn't really a good idea, and it's completely unnecessary. Create a usercontrol with your buttons, search and webkitbrowser in it and add the usercontrol to your TabPage.
 

oriax123

Member
Joined
Jul 14, 2012
Messages
8
Programming Experience
Beginner
Parenting a form isn't really a good idea, and it's completely unnecessary. Create a usercontrol with your buttons, search and webkitbrowser in it and add the usercontrol to your TabPage.
Im sorry for the noob question as i never tried that but can you describe what a usercontrol is and how i could use it in this case?
 

oriax123

Member
Joined
Jul 14, 2012
Messages
8
Programming Experience
Beginner
Ok i got the usercontrol set up already, when i try :

Form1_Load

Code:
[COLOR=#008000]
        'Adds tab to Tabcontrol1

        Dim newtab As New browser
        newtab.Text = "New Page"
        newtab.Dock = DockStyle.Fill
        TabControl1.Controls.Add(newtab)[/COLOR]
browser is the UserControl i made.

It does load onto the form BUT no tabs.

ljldsk.PNG
 

oriax123

Member
Joined
Jul 14, 2012
Messages
8
Programming Experience
Beginner
You can add tabpages to TabControl.TabPages collection, and controls to TabPage.Controls collection.
Im using dotnetbar for the tabs and its abit different than the tabcontrol that comes with vb.


ive tried:

dim newtab as new browser 'as browser is the usercontrol.vb

tabcontrol1.controls.add(newtab) 'this gives me an error saying a form cant go in a tabitem and what not

TabControl1.Tabs.Add(newtab) 'same error as above.

paint.png
 
Top Bottom