473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

C# - Add TabPage to Tab Control

I am developing a windows application using c# in that i used tabcontrol in MDI form to display the child forms. that is working fine. but my problem is when i click a button in that tabpage (child form) it must open another form that also as tabpage which i am not getting . pls help me in this ...pls.....

here is the code through which i am creating tabpages.

Expand|Select|Wrap|Line Numbers
  1.  
  2. public void settab(Form f2)
  3. {
  4. tabControl1.Visible = true;
  5. toolStripButton11.Visible = true;
  6. if (tabControl1.TabPages.ContainsKey(f2.Text))
  7. {
  8. MessageBox.Show("Form already Opened");
  9. tabControl1.SelectTab(f2.Text);
  10. }
  11. else
  12. {
  13. f2.TopLevel = false;
  14. TabPage tp = new TabPage(f2.Text);
  15.  
  16. currenttabcount++;
  17.  
  18. tp.Name = f2.Text;
  19. tp.AutoScroll = true;
  20. tp.BackColor = System.Drawing.Color.White;
  21. tp.ForeColor = System.Drawing.Color.White; ;
  22. tp.UseVisualStyleBackColor = true;
  23. tp.BorderStyle = BorderStyle.None;
  24. tp.Tag = f2;
  25. tabControl1.TabPages.Add(tp);
  26. //tp.Parent = tabControl1;
  27. tabControl1.SelectedTab = tp;
  28. f2.Tag = tp;
  29. f2.Parent = tp;
  30. f2.Location = new Point(0, 0);
  31. f2.Dock = DockStyle.Fill;
  32. f2.Show();
  33. }
  34.  
  35. }
  36.  
Jul 23 '08 #1
0 1949

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Robb Gilmore | last post by:
Hello, This is probably an easy one, but I have not been able to figure it out so far. I have a tab control on a windows forms app. Depending on some business logic, I need to hide/show some...
1
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...
8
by: touf | last post by:
Hi, I've a tabcontrol that contains many similar tabpages (exactly the same structure with different information), the tabpages number isn't known in the design time it depends of the data. Is...
4
by: Supra | last post by:
I have a tab control in a which a few of the tabs include an AxWebBrowser browser control. Let say i have currently tabpage2 and i typed url in combobox when i pressed enter it doesn't display...
4
by: Sam | last post by:
Hi, I need to add programmatically several tabpages to a tab control. Those tabpages are all the same (i.e they contain a textbox and a listbox, and a button). How can I create my own tab...
1
by: Ingo Beyer | last post by:
Hello, I created a windows form with vs.net 2005 / c#. This control has a TabControl with 16 TabPages. On every TabPage there are a diffrent number of Controls. - Every TabPage has a background...
0
by: Marc Solé | last post by:
Hi to everybody, I would like o clone a tabPage into the same tabControl with all the controls of the first tabPage. I have tried doing like this, but that way doesn't clone the controls. That...
2
by: John Wright | last post by:
I have the following routine I use to check for a certain tab page. I want to enable this tab page only on the tab control and set the focus. However, I cannot get the tab to set focus no matter...
6
by: ray well | last post by:
i want a user to be able to change tab pages thru the keyboard, i tried entering the TabPage.text as '&1 Names', "&2 Addresses', etc., so that the user can change pages by type ALT 1, ALT 2, on the...
6
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello gurus, I want to have a Form with a TabControl, this TabControl will contain TabPage that has controls in it, this TabPage is prepared at design time. I want in runtime to duplicate the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.