PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Tabpage Dynamically adding controls
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Tabpage Dynamically adding controls
![]() |
Tabpage Dynamically adding controls |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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??? |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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??? > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

