Do Control Array's work with VBA?

  • Thread starter Thread starter Kan D.
  • Start date Start date
K

Kan D.

Do control array's work with VBA?

example: something to do with the word "handle" or "handles" (i can't
remember) in the sub declaration:

Private Sub MyControl_Enter(Handle MyOtherControl)

End Sub

??? no what I mean? How do I do it?

Kan
 
Unfortantly, we don't have contorl arrays.

Often, a subsistlte for "repating" contorls (if you are using the vb.clone
methoed for cloing contorls -- aka a contorl array), then a continues form
is often a sotion.

I mention this here:
http://www.members.shaw.ca/AlbertKallal/Articles/Grid.htm

However, if you need to assing a "common" event to set of contorls, then you
can highligh all of hte ocntorls at the same time, and type in a fucntion
name into the particlar event you want

=MyCommonEvent()

Another way of grouping is to use the "tag" properity of a contorl...

for each mycontorl in contorls
if mycontorl.Tag = "group1" then
bla bla bal

Often, sometimes a loop in the forms load event, we can assing each control
(via the tag idea) to a vb collection. (this at least gives a nice group,
but does NOT give you a common event code).

And, we do have a "option" group control that allows check marks, or radio
buttons to be grouped together.

Between the above several approaches, we as a general rule don't need
control arrays, and their are ample work-arounds (but, control arrays are
missed as a feature).
 
Hi,


Control Array, not, but Array of controls, yes.


A subroutine handling an event is a subroutine like any other subroutine,
and may be called from elsewhere, not just from the "event firing". You can
also simply route to a common subroutine:

====================
Private Sub Command3_Click()
Call Testing() ' <----
End Sub


Private Sub Command2_Click()
Call Testing() ' <----
End Sub


Private Sub Command1_Click()
Call Testing() ' <----
End Sub
========================


and you can also pass some parameter to this "common" subroutine, etc. But
you probably see the pattern.


Hoping it may help,
Vanderghast, Access MVP
 
Back
Top