473,698 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding a Form to a TabPage

TN
I can add a button to a TabPage, how come I can't add a Form? The Form
never gets realized on the page, but a button can :-(

f = new System.Windows. Forms.Form();
b = new Button();
b.Text = "Hello";
f.Text = "NEW";
f.Size = new Size(100, 100);
f.Controls.Add( b);
f.TopLevel = false;
f.Dock = DockStyle.Fill;

t = new TabPage("Cash Receipts");
f.Parent = t;
t.Controls.Add( f);
tabControl1.Tab Pages.Add(t);
Dec 23 '05 #1
2 8103
TN
TN wrote:
I can add a button to a TabPage, how come I can't add a Form? The Form
never gets realized on the page, but a button can :-(

f = new System.Windows. Forms.Form();
b = new Button();
b.Text = "Hello";
f.Text = "NEW";
f.Size = new Size(100, 100);
f.Controls.Add( b);
f.TopLevel = false;
f.Dock = DockStyle.Fill;

t = new TabPage("Cash Receipts");
f.Parent = t;
t.Controls.Add( f);
tabControl1.Tab Pages.Add(t);


(sticking tail between legs)

f.Show();

Dec 23 '05 #2
Hi,

what about having a TabControl hosting multiple tabpages each hosting its
own form?
The below works fine for 1 hosted form but as soon as you add further forms
to further tabpages the additionial forms will not show (unless you politely
ask them to do so multiple times and are willing to wait a bit...)
"TN" <ti*******@phre aker.net> wrote in message
news:%2******** *********@tk2ms ftngp13.phx.gbl ...
TN wrote:
I can add a button to a TabPage, how come I can't add a Form? The Form
never gets realized on the page, but a button can :-(

f = new System.Windows. Forms.Form();
b = new Button();
b.Text = "Hello";
f.Text = "NEW";
f.Size = new Size(100, 100);
f.Controls.Add( b);
f.TopLevel = false;
f.Dock = DockStyle.Fill;

t = new TabPage("Cash Receipts");
f.Parent = t;
t.Controls.Add( f);
tabControl1.Tab Pages.Add(t);


(sticking tail between legs)

f.Show();

Feb 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7648
by: RA | last post by:
Hi 1) I want to create a TabPage class in design mode - how do I do it? What type of project should I use? Is it going to be a custom control? 2) I have a TabControl that I would like to add to it the TabPage created in step 1. I don't want to draw the TabPage on the Tabcontrol in design mode, but to have a few TabPage controls that I candynamicaly load to the TabControl at runtime. Thanks
4
1938
by: slylos | last post by:
I've got a Windows form that has a TabControl. I add TabPages to this TabControl at Runtime, along with two Textboxes and a button. The problem I'm having is I can't figure out how to reference the Textboxes elsewhere once they have been created. The TextBoxes are being named based on a private global counter (i.e. TextBox tb = new TextBox(); tb.Name = "tb" + (counter++).ToString();) They are being created in a private method called...
3
2236
by: Tom McL. | last post by:
My Program has two forms From1 and Form2. On From1 I have a TabControl1 witch has 8 tabs currently. I would like to add a new tab from Form2 is this possible? I have tried the following code on Form2 with no success: Public MyFrom1 As New From1 Private Sub btnNewTab_Click(ByVal sender As System.Object, ByVal e As
2
2209
by: GatorBait | last post by:
Hi everyone, I have a tabcontrol on a form that contains 4 tabs. I want to make each tab a seperate form because there is a great deal of code behind each page, and organizationally it was easier to have each one seperate. My idea was to just add and remove each form as necessary based on what page the user clicked on, but I am getting an error when I try to add the form as a tabpage: Dim frm as new Form1
4
1705
by: Philip Wagenaar | last post by:
I have made a form with a tab that containts groupboxes and those contain checkboxes. When I run the application sometimes the outlining for some groupboxes are not shown, if I switch tabs and back sometimes all outlining is shown and sometimes are not shown. I have no idea what is going wrong. What also is weird is that when I open the form from my main application I can resize the form, even though it is locked, and that when I cut...
8
3579
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a picture box, lots of text boxes (for input).. you get the idea. All of a sudden everything on the form has disappeared, it looks like a blank, newly created form. I can still get to the properties of every item on the form using the drop-down box in...
11
18124
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with ListView columns so it should be doable, thanks
12
2364
by: Rob | last post by:
Let's say you open Form1 that contains TabControl1 There are several tabs on TabControl1 Now you open a new Form2 that contains a User Control How can you determine the Selected tab in Form1 from the User Control in Form2 ? Hope this is clear enough...
1
2008
by: RobcPettit | last post by:
Hi, I have two forms. From form1(frmMain) I want to add tabpages to Form2. In form1 I have: frmMain tbe = new frmMain(); Thread thread = new Thread(new ThreadStart(tbe.AddTab)); thread.IsBackground = true; thread.Start(); In Form2 I have: public delegate void mydata(String e);
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.