Control Arrays

Control Arrays

Anonymous
Not applicable
325 Views
4 Replies
Message 1 of 5

Control Arrays

Anonymous
Not applicable
When you copy a control on a form in VB6 you get asked if you would like to
create a control array. This does not happen in VBA.
Is it possible to do this through code in VBA?

All Hints Appreciated

Marty
0 Likes
326 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Marty had this to say
:
> All Hints Appreciated

VBA does not support control arrays.

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com
0 Likes
Message 3 of 5

Anonymous
Not applicable
> > All Hints Appreciated

with that said, you can accomplish some things with controls named
similarly. for example, I have a form with 11 option buttons, named Opt1
thru Opt11. upon pressing a button, the button_click event will loop through
all controls on form looking for name like "Opt*", then see which of them is
value = true. then the last one or two characters of the control is the
index for deciding what to do based on user's selection. definitely not as
clean as a control array, but accomplishes the same thing.

--
Kevin
0 Likes
Message 4 of 5

Anonymous
Not applicable
Kevin Terry had this to say
:
>>> All Hints Appreciated
>
> with that said, you can accomplish some things with controls named
> similarly.

Conversely, you could simply have all realted controls invoke a common
subroutine passing themselves or some other identifying characteristic.

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com
0 Likes
Message 5 of 5

Anonymous
Not applicable
..Something like a bunch of Command Buttons with tag values of 1, 2, 3...n.

Then for each button, you could call a routine:
MyRouytine(CommandButton.tag)

Michel.


"Frank Oquendo" a écrit dans le message news:
D5DE8E00AAA911068D9921DEA0BA6918@in.WebX.maYIadrTaRb...
> Kevin Terry had this to say
> :
> >>> All Hints Appreciated
> >
> > with that said, you can accomplish some things with controls named
> > similarly.
>
> Conversely, you could simply have all realted controls invoke a common
> subroutine passing themselves or some other identifying characteristic.
>
> --
> There are 10 kinds of people:
> Those who understand binary and those who don't
> http://www.acadx.com
>
>
>
>
0 Likes