Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2005

Tip: Looking for answers? Try searching our database.

How to add tabpage to tabcontrol at 1st tab?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tee - 17 Jan 2005 02:05 GMT
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
Ed Kaim - 17 Jan 2005 07:03 GMT
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;

> Hi,
>
[quoted text clipped - 5 lines]
> Thanks,
> Tee
Mick Doherty - 17 Jan 2005 10:15 GMT
There's no better way ;-)

Signature

Mick Doherty
http://dotnetrix.co.uk/nothing.html

> There's probably a better way, but some C# code that seems to work is:
> TabPage p = new TabPage("My Tab Page");
[quoted text clipped - 20 lines]
>> Thanks,
>> Tee
Cor Ligthert - 17 Jan 2005 09:33 GMT
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
Mick Doherty - 17 Jan 2005 10:13 GMT
> Tee,
>
[quoted text clipped - 3 lines]
>
> 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

Signature

Mick Doherty
http://dotnetrix.co.uk/nothing.html

Cor Ligthert - 17 Jan 2005 10:26 GMT
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
Mick Doherty - 17 Jan 2005 12:05 GMT
Sorry Cor.
I'd just got up and hadn't had my fix of Coffee yet.

Signature

Mick Doherty
http://dotnetrix.co.uk/nothing.html

> Mick,
>
[quoted text clipped - 4 lines]
>
> Cor

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.