Solved

Form inside TabControl (not the other way round)

Posted on 2007-04-03
6
236 Views
Last Modified: 2010-04-23
I have a TabControl inside a Form. In the TabControl, I want to show another Form at runtime. How can I do this ?
0
Comment
Question by:rajesh_khater
6 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18843267
use user controls
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18843270
form EE:

You can convert your form to a user control.  That allows you to layout all of the controls in the same way as a form, but without the non-client border, caption, and buttons.

Do you need the non-client stuff as well or are you just trying to encapsulate all of the controls that would go on a form or a tab page?  If you're doing it for encapsulation, create the user control and place one in the tab page, and you can place another on an empty form.  If you actually want the non-client area within a tab page, you might be able to paint and manage that yourself, but it would be alot of coding (painting, mouse/keyboard handling, drag drop, etc) to do it.
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18843271
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 62

Accepted Solution

by:
Fernando Soto earned 300 total points
ID: 18843307
Hi  rajesh_khater;

In answer to your question, this is how to add a form control NewForm to a tab page of a tab control.

        Dim newFrm As New NewForm
        newFrm.TopLevel = False
        newFrm.Parent = TabPage1
        newFrm.WindowState = FormWindowState.Maximized
        newFrm.Show()

Fernando
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18843402
Rajesh,

Check your other question on this topic -- user controls have already been recommended, along with the same limitations pointed out by theGhost.
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 200 total points
ID: 18843552
You can make the forms borderless and set their Dock property to Fille when you place them into the TabControl to make them "seamless"...

*** Very similar code to Fernando's post above ***

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fa As New FormA
        ' initialize "fa" if needed...
        AddFormToTabControl(TabControl1, fa)
    End Sub

    Private Sub AddFormToTabControl(ByVal tb As TabControl, ByVal frm As Form)
        Dim tp As New TabPage
        tp.Text = "Tab" & tb.TabPages.Count + 1

        frm.TopLevel = False
        frm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        frm.Dock = DockStyle.Fill
        tp.Controls.Add(frm)
        frm.Show()

        tb.TabPages.Add(tp)
    End Sub

End Class
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

21 Experts available now in Live!

Get 1:1 Help Now