473,545 Members | 2,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TabControl question.

Gav
I am writing an application where I will have a TabControl and 3 styles of
Tabs to go in it, each containing different controls. The tabs will be added
to the tabcontrol when items are clicked on in a TreeView. So the the
application starts by displaying no tabs and adds them in as required. There
could be any number of each tab (0 upwards).

What is the best way of me doing this? Should I create 3 custom controls
that extend TabPage? I've only been doing this for a couple of days so any
advice would be great.

thanks

Gav
Sep 13 '07 #1
2 2772
Hi,

"Gav" <ga*@nospam.com wrote in message
news:ep******** ******@TK2MSFTN GP02.phx.gbl...
>I am writing an application where I will have a TabControl and 3 styles of
Tabs to go in it, each containing different controls. The tabs will be
added to the tabcontrol when items are clicked on in a TreeView. So the the
application starts by displaying no tabs and adds them in as required.
There could be any number of each tab (0 upwards).

What is the best way of me doing this? Should I create 3 custom controls
that extend TabPage? I've only been doing this for a couple of days so any
advice would be great.
When you are designint it just create your TabPages inside the tabcontrol,
when you are done you remove the part of the code when those pages are added
to the tabcontrol. Finally you can add/remove then using code:

tabControl.TabP ages.Remove( tabPage1);
tabControl.TabP ages.Add( tabPage2);
tabPageXXX will be created by the designer and will be member of the class.

If you want to do this dynamically you can do a similar approach but just
creating the pages as you need, In this case you just cut the code generated
by the designer.
Sep 13 '07 #2
On 13 Sep, 16:09, "Gav" <g...@nospam.co mwrote:
I am writing an application where I will have a TabControl and 3 styles of
Tabs to go in it, each containing different controls. The tabs will be added
to the tabcontrol when items are clicked on in a TreeView. So the the
application starts by displaying no tabs and adds them in as required. There
could be any number of each tab (0 upwards).

What is the best way of me doing this? Should I create 3 custom controls
that extend TabPage? I've only been doing this for a couple of days so any
advice would be great.

thanks

Gav
I'm not sure I fully understand what you want to do, but I can give
you an idea, and you'll decide if it fits for you.
I would create in designed a single TabControl containing ALL
possibile TabPages.
In form's constructor, right after calling InitializeCompo nent(), I
would initialize 3 arrays of TabPages. You must declare the array as
members of your form's class. Each array containg the combination of
TabPages that should be displayed when items are clicked in TreeView
control. I would set the Tag property of each TreeNode to the
corresponding array. This will help you later.

After initializing the arrays, you may clear all TabPages, so
initially, you have an empty TabControl.
When a TreeNode is selected, you just need to:
1. clear the TabPages in TabControl.
2. get the list of TabPages using TreeNode's Tag property and add the
pages to the TreeControl.

I didn't try this, but I don't see any reason it shouldn't work...
Hope it helps.

Sep 13 '07 #3

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

Similar topics

5
2007
by: meh | last post by:
New to C#... I have a tab page with a handful of controls on it (label, combobox, etc.). Is it possible to "boilerplate a tabPage with the controls "like a MDI childForm" so that adding a new tabPage includes the controls. Any examples, documentation or comments would be helpful. tia meh
0
1249
by: David Veeneman | last post by:
I've come across an odd bit of behavior on the VS 2005 TabControl, and I'm wondering if its a bug, or if I'm missing something. I have a TabControl with five tab pages. Each page has a DataGridView control. On FormLoad, I bind the grids to DataTables and set the grid columns' HeaderText to the column captions from the DataTables. The...
5
5139
by: Max | last post by:
This is a two part question. First, how does one go about designing forms that can reflect the XP theme? Take the TabControl for example, even on default the one that you can use in VB.NET looks different from the one that appears in all XP programs. Is it some reference that I need to add, or what? Second question is specifically about...
2
2828
by: Richard | last post by:
Hi, Simple tabcontrol question: I have a tab control with a number of tabpages on it. What I want is to show a particular tabpage when I click a button that is not on the tabcontrol. Can anyone tell me how I would code this? Thanks Richard
8
4135
by: ChrisK | last post by:
Hi, I'm beginner with VB.net and i have a trouble... At work, they decided to program with tabcontrol...and i'mm in charge of this ! There is my problem. I've a form with one tabcontrol (TBC1 ). This TBC1 contents n TabPages ( TBP1,2,3,..,n) For each TBPn i 've got an specific usercontrol which have controls and code ( data access, ......
5
3327
by: Zadkin | last post by:
Does anyone know, if it's possible to set the orientation of the tabpagebuttons to horizontal instead of vertical when the alignment property of my tabcontrol is set to left or right? Thanks in advance Zadkin
2
2835
by: Rex the Strange | last post by:
I suspect the answer to this question is "you can't," but here goes anyway: I have a tabcontrol which contains, of course, various tabpages (added programmatically at runtime, but this is irrelevent to the question). I've noticed, however, that the actual drawing canvas of the tabpage is not flush with the edge of the tabpage. There is...
0
1610
by: qinger | last post by:
Hello, I am trying to organize the controls on a TabControl. The tabcontrol is sitting on a dialog with OK and Cancel buttons. So I created 2 TableLaoutPanels -- one for TabControl and one for OK/Cancel buttons. On the TabControl, there are a few tab pages. Each page has different number of controls. My question is: Should I create...
0
2349
by: =?Utf-8?B?TWFydGluIw==?= | last post by:
Hello everybody! Please note that I have posted same question in different forums with no success. So If you tried to help me there, please do not consider the repost as rude! I'm working on an application which has UserControls (GUI pages) with TabControls on it. This TabControls are Usercontrols derived from Windows.Forms.TabControl....
0
7502
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...
0
7692
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. ...
0
7791
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...
0
6026
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...
0
5078
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...
0
3491
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...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
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
0
744
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...

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.