Connecting Tech Pros Worldwide Help | Site Map

How to create: Form inside tab

Newbie
 
Join Date: Jul 2009
Posts: 6
#1: Jul 2 '09
I was wondering if it was possible to have a form inside a tab control? So when a tab is clicked, there is a form within it.

If it is possible, then how should I go about doing it?

Thank you.
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,751
#2: Jul 3 '09

re: How to create: Form inside tab


A 'form', meaning a System.Windows.Forms.Form control? No, I don't think you can do that.

You can make a user control that is all the controls you would want, then drop that on the Tabpage or drop it on a Form and be able to use it either way.
insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,605
#3: Jul 3 '09

re: How to create: Form inside tab


Please provide more specific details in your question, including which technology you are using (ASP.NET, Windows Forms, WPF, etc) and what Framework version you are using.

Also, Form is a very vague word. Do you mean System.Windows.Form, the HTML Form tag, or the generic meaning of a bunch of input fields? Please be more specific.
Newbie
 
Join Date: Jul 2009
Posts: 6
#4: Jul 8 '09

re: How to create: Form inside tab


Hi, I am using Microsoft Visual 2008 C#. And would like to create a subform inside if a form. All the tutorials online ask me to click on the "Control Wizard" button and the "Form/Subform" button on the toolbox, which I am unable to find. Is there something which needs top be downloaded or the form opened in a special way?
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#5: Jul 9 '09

re: How to create: Form inside tab


You can infact stick a windows form inside a tab control. I went that route with one of my projects. I found it easier to code for each "tab" seperately.

Here's a snipit I use:
Expand|Select|Wrap|Line Numbers
  1. //in the form with the tab control:
  2. MyForm stc = new MyForm();
  3. stc.TopLevel = false;
  4. stc.Parent = this;
  5. stc.Dock = DockStyle.Fill;
  6. stc.FormBorderStyle = FormBorderStyle.None;
  7. tabTheTabIWantTheFormToBeIn.Controls.Add(stc);
  8. stc.Show();
  9.  
Setting the TopLevel proeprty to false is the key thing to do.
Newbie
 
Join Date: Jul 2009
Posts: 6
#6: Jul 9 '09

re: How to create: Form inside tab


Thank you so much :D
Reply