setting the order of TabPages in a TabControl

setting the order of TabPages in a TabControl

Post by Ed Debro » Sun, 08 May 2005 02:10:15



I can't seem to make any sense of how to control the order of my TabPages on
a TabControl. I can set the Index property in regular .Net but can't do that
in CF .Net. Does anyone know how to set the order of TabPages at runtime?

Note that I am able to hide pages using RemoveAt.

thanks.
 
 
 

setting the order of TabPages in a TabControl

Post by Daniel Mot » Sun, 08 May 2005 02:15:43

You have to clear the tabcontrol.pages and re-add them.. not in the
designer... at runtime e.g. after InitializeComponent or in form_load:
http://www.yqcomputer.com/ +bug&qt_g=1&searchnow=Search+this+group

Cheers
Daniel

 
 
 

setting the order of TabPages in a TabControl

Post by Ed Debro » Sun, 08 May 2005 06:15:29

It appears that the only thing that works consistantly in .Net CF is to go
into the Windows generated code and re-order the loading of tabpages,
tc.Controls.Add(tp), in the order that you want them displayed. The code
below works fine in desktop .Net.

thanks for the reply.





http://www.yqcomputer.com/ +bug&qt_g=1&searchnow=Search+this+group


TabPages
runtime?
 
 
 

setting the order of TabPages in a TabControl

Post by Daniel Mot » Sun, 08 May 2005 06:20:38

Yes it works on the desktop and yes it is a bug.
You can at runtime clear the tabs and re-add them in your preferred order as
I suggested and that works consistently too.

Cheers
Daniel
 
 
 

setting the order of TabPages in a TabControl

Post by Chris Tack » Sun, 08 May 2005 06:43:02

And as soon as you modify the Form, the designer will hose it again. Follow
Daniel's advice and reorder them outside of InitializeComponent in the ctor.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.yqcomputer.com/
 
 
 

setting the order of TabPages in a TabControl

Post by Ed Debro » Sun, 08 May 2005 07:08:00

I tried his advice and it works fine on the desktop but not in CF .Net. I
also tried several variations and suggestions based on other threads. No
luck. It's true that the designer will hose my tab order but only if I add
more tab pages to the specific tab control in question and I want the added
tab page to be somewhere other than the end. Your concern is noted and I
would agree if I could get it to work as suggested.

thanks.




Follow
ctor.


go


http://www.yqcomputer.com/ +bug&qt_g=1&searchnow=Search+this+group


do
 
 
 

setting the order of TabPages in a TabControl

Post by Paul G. To » Sun, 08 May 2005 07:44:05

What happens when it "doesn't work"?

Paul T.
 
 
 

setting the order of TabPages in a TabControl

Post by Daniel Mot » Sun, 08 May 2005 13:26:16

ou will lose your changes every time you change anything via the designer.
Step back and look at the big picture. We've all had this problem and we've
all solved it as suggested. Do you really think your case is "special"?

If you need more help, post a small reproducible sample along with a
description of the actual results and the expected results (including what
device you are targeting and framework version).

Cheers
Daniel

"Ed Debrot" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...