How to make a same component visible from two Tab Pages of a Tab control

Posted on 2012-09-04
Last Modified: 2012-09-04
Hi Experts,

I want to be able to make the same DataGridView component visible no matter which Tab Page is selected on a Tab control. The idea is to use the same DataGridView but using a different column layout.

I could do this with VB6, but with VB.NET it appears that the DataGridView component is a member of one Tab Page only.

The attached graphics show what I have in mind.

Question by:LeighWardle
    LVL 85

    Accepted Solution

    "... but with VB.NET it appears that the DataGridView component is a member of one Tab Page only."

    That's correct.  A control can only have ONE container.  When you add a control to a container, though, it will automatically be removed from its previous container.

    Thus you could do:
        Private Sub TabControl1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
            ' Move the DataGridView to the Current Tab:
            ' Change the DataGridView somehow:
            Select Case TabControl1.SelectedIndex
                Case 0
                    ' configure the columns for tab 0
                Case 1
                    ' configure the columns for tab 1
                Case 2
                    ' configure the columns for tab 2
            End Select
        End Sub

    Open in new window

    LVL 1

    Author Closing Comment

    Brilliant, thanks, your mind isn't that idle is it?

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now