Re: Controlarray in VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



You might want to try the following:
1. For all the similar controls, set the index of the control in its Tag
property.
2. Write a function that would have the event handler code and accepts the
index as one of its input parameter.
3. Create event handler for the controls that call function of (2) with the
Tag of the control as input to the function.

While this technique does require a single line event handler - one for each
control, but it comes close to VB control arrays.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html

"Vera" <Vera@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:924DF2C0-4574-453F-A4F9-83368D4C59BD@xxxxxxxxxxxxxxxx
> Hi there!
>
> I wonder if it is possible to create a controlarray in VBA.
> I have a form with a lot of similar controls that require similar
> handling.
> A controlarray with indexed event-handlers would be ideal in a situation
> like this.
>
> Is this possible? If so, how? If not, then what can I do to avoid getting
> about a hundred similar event-handlers?
>
> Any help will be greatly appreciated.
> Thanx!
>
> Vera
>

.



Relevant Pages

  • Re: How to modify label.text in a dynamically generated label in VB.net
    ... Your event handler will go something like this: ... If _tag IsNot Nothing Then ... Private Function FindControl(ByVal start As Control, ByVal type as Type, ... When any one of you dynamic CheckBoxes is clicked, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Setting FaceID on Custom Button
    ... You can, for example, apply a Tag to your control. ... the same way as you set the caption). ... "MyControl Off". ...
    (microsoft.public.word.docmanagement)
  • Re: Function executed twice
    ... I would also like to say, just in case you don't do it already, that using prefixes for your control ids can make it easier when working in code. ... You do NOT need to add anything to the tag in the *.aspx file ... > code-behid I usually click twice in the link/button and that will ADD the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Does go have a return value ?
    ... If (go tag) ... semantics of go any more than unwind-protect does. ... control to the TAG. ... formal methods anyway; this is more suited to pure functional ...
    (comp.lang.lisp)
  • Re: Does go have a return value ?
    ... If (go tag) ... Does this present any bigger problems than unwind-protect? ... UNWIND-PROTECT very explicitly defines the order of execution of the ... through an abnormally (including a transfer of control). ...
    (comp.lang.lisp)