[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

Tabs in VB.net app

I want to create tabs to allow a user to select different ways of using a program that I am writing in VB.net.  How can I create tabs, and associate pages for each tab, as depicted in the following image?

http://www.stevetout.com/tabs.jpg

If you are going to share code, please show code samples, not entire applications.  
0
gmahler5th
Asked:
gmahler5th
  • 4
  • 4
2 Solutions
 
armoghanCommented:
Why dont you drag and use the Tab control from the Toolbar.
Its very simple to use.

Or do you want to make a custom Tab control?
0
 
planoczCommented:
0
 
gmahler5thAuthor Commented:
The thing is I already have a form that I want to disply on tab 1.  When using tabs, how can I add one to use with an existing form and then add a 2nd one for my 2nd form?  I'd prefer to use built in VB controls then to download 3rd party code.

Thanks.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
planoczCommented:
add this to your form to see how to add controls to your tabs etc.....
Add 3 buttons and a tabcontrol to your form

   Private Sub btnTab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTab.Click
        Dim myTabPage As New TabPage
        myTabPage.Text = "TabPage" & (TabControl1.TabPages.Count + 1)
        TabControl1.TabPages.Add(myTabPage)
    End Sub

    Private Sub btnControl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnControl.Click
        ' Adds a Groupbox to the selected tab page
        TabControl1.SelectedTab.Controls.Add(New GroupBox)
    End Sub
    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        ' Removes the selected tab:
        TabControl1.TabPages.Remove(TabControl1.SelectedTab)
    End Sub
0
 
gmahler5thAuthor Commented:
Wuld this code change if I only need 2 tabs???
0
 
planoczCommented:
No. You could just add the two tabs at design time or add them at run time.
0
 
gmahler5thAuthor Commented:
i'm really confused.  I'm not sure of the exact steps you are reccommending.  

Here is what I currently have in my application.  http://www.stevetout.com/current.jpeg

Can you please be more specific about the steps to create two tabs?  The first tab should display the current form.  The 2nd tab should display a new form, which I have not created yet.  
0
 
planoczCommented:
I do not see any tabs on your form.

Are we talking about tabs or multi forms?
and what do you want on the second tab or form?
0
 
gmahler5thAuthor Commented:
I want tabs available to switch between two different forms, I.e. two different ways to calculate a mortgage loan.

I need to create tabs on my existing form.  That is half of my battle.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now