473,761 Members | 8,011 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# - Add TabPage to Tab Control

1 New Member
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 1985

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

Similar topics

9
883
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 of the individual tabs. The tab page has no "visible" property. The tabpage class has a "hide" method, but this does not seem to make it disappear. I have been able to remove them via something like this:
1
7652
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
8
12068
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 there a way to clone ( copy the structure) a tabpage to create anew one by code? thanks.
4
3490
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 webbrowser instead i can do create new tab. ne one knows how to display currrently displayed regardless of tabpage(s)? here is code: Public Sub AddBrowserTab() AxWebBrowser1.Visible = False Dim newPage As TabPage = New TabPage(Text) ' Delcare and...
4
2507
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 control so that when I add a tabpage, it will add also the other components ? Regards
1
3159
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 picture. they are all the same picture (from a resouce file). There seems to be no way easy to make a TabControl transparent... my problem: while switch the visible TabPage the form / TabControl begans to flicker. it takes a second (and I mead...
0
3050
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 way move the controls from the first tabPage to the second one. Thanks a lot!
2
14317
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 what I do. Any suggestions? Public Sub SetTabs(ByVal TabID As String) For Each Ctrl As Control In Me.Controls If TypeOf Ctrl Is TabControl Then If Ctrl.HasChildren Then
6
4568
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 keyboard. but the text showing up in the tab is '&1 Names' instead of the '1' being underlined, and being able to be accessed thru the keyboard. how can i get a user to be able to change from TabPage to TabPage thru the keyboard? i find it...
6
12932
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 TabPage that wad made during the design time together with all its controls, but without the controls data. Is there an easy way to do that?
0
9554
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
9376
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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...
0
9988
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8813
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...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3911
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
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.