I am completely frustrated trying to control the order that dynamically
created controls appear in a TabPage.

I have tried
tp.Controls.Add(myControl) in a loop which does not work.

I then added my controls to a Control array
Control[] oConts and tried tp.Controls.AddRange(oConts); which does not work

Then I tried, in addition to the above, looping through and explicitly
seting the childindex

with

tp.Controls.SetChildIndex(myCont,iIndex); which still does not work

Is this a known bug or am I overlooking something very simple???

Re: Tabpage Dynamically adding controls by Eric

Eric
Wed May 12 13:30:52 CDT 2004

After some more investigation I determined the controls were rendering in
the reverse order in which I wanted them. So as a workaround I am able to
achieve what I'm after by adding my controls in reverse order. This makes
no sense but it seems to work.

"Eric" <msdnsupport@nospammediserve.com> wrote in message
news:uhEeVuEOEHA.1388@TK2MSFTNGP09.phx.gbl...
> I am completely frustrated trying to control the order that dynamically
> created controls appear in a TabPage.
>
> I have tried
> tp.Controls.Add(myControl) in a loop which does not work.
>
> I then added my controls to a Control array
> Control[] oConts and tried tp.Controls.AddRange(oConts); which does not
work
>
> Then I tried, in addition to the above, looping through and explicitly
> seting the childindex
>
> with
>
> tp.Controls.SetChildIndex(myCont,iIndex); which still does not work
>
> Is this a known bug or am I overlooking something very simple???
>
>



RE: Tabpage Dynamically adding controls by v-yiy

v-yiy
Thu May 13 01:55:35 CDT 2004

Hi Eric,

The order of ControlsCollection is the Z-order of the controls in that
container control. Controls[0] is in the forground and Controls[1] is
behind the Controls[0], etc. If you need add some controls dynamically
from back to front, they should be added to controls collection in reverse
order. I'm not sure why SetChildIndex not work, could you post a small
snippet to show how you use the SetChildIndex method?

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.