473,811 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ 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 17 '05 #1
6 1352
There's probably a better way, but some C# code that seems to work is:
TabPage p = new TabPage("My Tab Page");

this.tabControl 1.TabPages.Add( p);

for (int lcv = this.tabControl 1.TabPages.Coun t - 1; lcv > 0; lcv--)

{

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

}

this.tabControl 1.TabPages[0] = p;
"Tee" <th*@streamyx.c om> wrote in message
news:Ov******** ******@TK2MSFTN GP12.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 17 '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 17 '05 #3
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:OZ******** ******@TK2MSFTN GP11.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 17 '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******** ********@TK2MSF TNGP09.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.tabControl 1.TabPages.Add( p);

for (int lcv = this.tabControl 1.TabPages.Coun t - 1; lcv > 0; lcv--)

{

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

}

this.tabControl 1.TabPages[0] = p;
"Tee" <th*@streamyx.c om> wrote in message
news:Ov******** ******@TK2MSFTN GP12.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 17 '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 17 '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******** *****@TK2MSFTNG P09.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 17 '05 #7

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

Similar topics

4
13579
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. This appears to be a bug, or maybe I'm using it incorrectly? TabPage.Hide should hide the referenced TabPage object, should it not? Do I have to 'refresh' the Windows form somehow? The closest I've come to any means of hiding a TabPage from...
5
2020
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
4
1883
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 the tabpages(A-D) in the tabControl. Now there is a button on TabPage A & when the button is clicked the default view changes to a tabcontrol having three tabpages A,B & D.
1
7654
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
3
3486
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. If I use remove to remove that tabpage and later use add to add it back in, I have to write code to create all the controls inside that tabpage, otherwise it will be a blank page. What can I do to avoid it? Thank you for your time and help.
8
12074
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
1643
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 prevent bad entries but if I click onto another tabpage, I can leave the current tabpage. I try to use the select property but it doesn't work. Any idea ?
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...
2
2845
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 always a small one pixel border on the top, right and bottom and a three pixel border on the left. So,...
6
4571
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...
0
9734
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...
1
10408
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
10137
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
9211
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
7673
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
6895
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
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
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
2
3874
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.