473,473 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to add tabpage to tabcontrol at 1st tab?

Tee
Hi,

I have a tabcontrol that has a tabpage, I want to add another tabpage on
runtime, but I want the tabpage to be added to the 1st tab, anyone know how
to do it?
Thanks,
Tee
Nov 21 '05 #1
6 1182
There's probably a better way, but some C# code that seems to work is:
TabPage p = new TabPage("My Tab Page");

this.tabControl1.TabPages.Add(p);

for (int lcv = this.tabControl1.TabPages.Count - 1; lcv > 0; lcv--)

{

this.tabControl1.TabPages[lcv] = this.tabControl1.TabPages[lcv - 1];

}

this.tabControl1.TabPages[0] = p;
"Tee" <th*@streamyx.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a tabcontrol that has a tabpage, I want to add another tabpage on
runtime, but I want the tabpage to be added to the 1st tab, anyone know
how
to do it?
Thanks,
Tee

Nov 21 '05 #2
Tee,

Because of a bug in the tabpages, you have probably first to "remove" all
the existing ones and than "add" again all the ones in the sequence that you
want them.

Cor
Nov 21 '05 #3
"Cor Ligthert" <no************@planet.nl> wrote in message
news:OZ**************@TK2MSFTNGP11.phx.gbl...
Tee,

Because of a bug in the tabpages, you have probably first to "remove" all
the existing ones and than "add" again all the ones in the sequence that
you want them.

Cor


No! Don't remove tabpages as this will cause unsightly flicker. Simply swap
tabpages.

On my site you'll find routines for inserting a tabpage which uses a loop to
swap tabpages until the new tabpage is where you want it.
http://dotnetrix.co.uk/tabcontrols.html --> Hide and show tabpages in
Tabcontrol

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 21 '05 #4
There's no better way ;-)

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Ed Kaim" <ed@sharplogic.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
There's probably a better way, but some C# code that seems to work is:
TabPage p = new TabPage("My Tab Page");

this.tabControl1.TabPages.Add(p);

for (int lcv = this.tabControl1.TabPages.Count - 1; lcv > 0; lcv--)

{

this.tabControl1.TabPages[lcv] = this.tabControl1.TabPages[lcv - 1];

}

this.tabControl1.TabPages[0] = p;
"Tee" <th*@streamyx.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
Hi,

I have a tabcontrol that has a tabpage, I want to add another tabpage on
runtime, but I want the tabpage to be added to the 1st tab, anyone know
how
to do it?
Thanks,
Tee


Nov 21 '05 #5
Mick,

Everything can be done better, however to say a screaming "No" to it is in
my opinion overdone.

Not angry, just friendly laughing.

Cor
Nov 21 '05 #6
Sorry Cor.
I'd just got up and hadn't had my fix of Coffee yet.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Cor Ligthert" <no************@planet.nl> wrote in message
news:O4*************@TK2MSFTNGP09.phx.gbl...
Mick,

Everything can be done better, however to say a screaming "No" to it is in
my opinion overdone.

Not angry, just friendly laughing.

Cor

Nov 21 '05 #7

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

Similar topics

4
by: TMB333 | last post by:
I've researched as much as I can on the issue, but I've not found any clearly defined statement that acknowledges that the Hide method for a TabPage object just doesn't do what it's supposed to do....
5
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...
4
by: Sumit | last post by:
Hi all, I am working on an application in which there is a form which has a tabcontrol containing 4 tab pages. Let the name of the tabpages be A,B,C&D. The default view is that there are all...
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...
3
by: Cynthia | last post by:
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should use Remove/Add. But I have some other controls in the tabpage which I don't want to use code to dynamiclly create them....
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: Stan Sainte-Rose | last post by:
First, I thank you Herfried. I have 3 tabpages in a tabcontrol. I would like to force the user to stay in the current tabpage until he doesn't correctly fill some textboxes. I know how to...
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...
2
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...
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...
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...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.