Prev: Disable the search feature of a ComboBox
Next: A Way for saving control with all of it's components and properties to a file or stream.
From: Mr. X. on 15 Jun 2010 18:33 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 :)
From: Cor Ligthert[MVP] on 16 Jun 2010 02:49 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. "Mr. X." <nospam(a)nospam_please.com> wrote in message news:efutSrNDLHA.3880(a)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 :) > >
From: Phill W. on 16 Jun 2010 06:09 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.
From: Mr. X. on 16 Jun 2010 07:54
I found a solution - thanks. After setting the parent : Parent.Controls.SetChildIndex(myNewObject, 0) Thanks :) "Phill W." <p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k> wrote in message news:hva7sr$q0g$1(a)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. |