|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
insert control to parent at reverse order.Hello.
I see that, when insert controls to the same parent on the following way : control1.parent = commonParent control2.parent = commonParent commonParent.controls(0) ' this is coltrol1 commonParent.controls(1) ' this is control2 But, when I am doing so on design time, the order is reversed (and that what's I need). commonParent.controls(0) ' this is coltrol2 commonParent.controls(1) ' this is control1 How can I insert into the parent, the controls with reverse-order? Thanks :) Design time and runtime is not different in VB versions newer then VB6.
Everything which is done in design time is created as code which runs at runtime. Take a look at the file, YourProgram.designer.vb The adding to the control collections is maybe evaluated every time again at design time, therefore you are told not to change that, because then you can get unpredictable results. However, the way controls are added to the control collections, is not important, like every collection it has no fixed sequence, it is just filling up down. Show quoteHide quote "Mr. X." <nospam@nospam_please.com> wrote in message news:efutSrNDLHA.3880@TK2MSFTNGP04.phx.gbl... > Hello. > > I see that, when insert controls to the same parent on the following way : > control1.parent = commonParent > control2.parent = commonParent > > commonParent.controls(0) ' this is coltrol1 > commonParent.controls(1) ' this is control2 > > But, when I am doing so on design time, the order is reversed (and that > what's I need). > commonParent.controls(0) ' this is coltrol2 > commonParent.controls(1) ' this is control1 > > How can I insert into the parent, the controls with reverse-order? > > Thanks :) > > On 15/06/2010 23:33, Mr. X. wrote:
> I see that, when insert controls to the same parent on the following way : Annoying, isn't it?> control1.parent = commonParent > control2.parent = commonParent > > commonParent.controls(0) ' this is coltrol1 > commonParent.controls(1) ' this is control2 > > But, when I am doing so on design time, the order is reversed (and that > what's I need). > commonParent.controls(0) ' this is coltrol2 > commonParent.controls(1) ' this is control1 > > How can I insert into the parent, the controls with reverse-order? Why do you need them in any particular order within the parent's Controls collection? If you're trying to set the navigational (tab) order, you can set the TabIndex property separately. HTH, Phill W. I found a solution - thanks.
After setting the parent : Parent.Controls.SetChildIndex(myNewObject, 0) Thanks :) Show quoteHide quote "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message news:hva7sr$q0g$1@south.jnrs.ja.net... > On 15/06/2010 23:33, Mr. X. wrote: > >> I see that, when insert controls to the same parent on the following way >> : >> control1.parent = commonParent >> control2.parent = commonParent >> >> commonParent.controls(0) ' this is coltrol1 >> commonParent.controls(1) ' this is control2 >> >> But, when I am doing so on design time, the order is reversed (and that >> what's I need). >> commonParent.controls(0) ' this is coltrol2 >> commonParent.controls(1) ' this is control1 >> >> How can I insert into the parent, the controls with reverse-order? > > Annoying, isn't it? > > Why do you need them in any particular order within the parent's Controls > collection? If you're trying to set the navigational (tab) order, you can > set the TabIndex property separately. > > HTH, > Phill W. |
|||||||||||||||||||||||