Exceptions List

way2bord

Registered User.
Local time
Today, 05:06
Joined
Feb 8, 2013
Messages
177
Is there a cleaner method of holding an unknown number of strings than constantly redim'ing an array?

Is it less process-intensive to latebind in a dictionary.object, rather than constantly changing an array's size?
 
Can you elaborate on how you intend to use them? Some ideas might be generated from that.
 
Can you elaborate on how you intend to use them? Some ideas might be generated from that.

An exception list.

ie.
If I have 10 textboxes: txtbox1, txtbox2, txtbox3... txtbox10

for each ctrl on form
if not [in exception list] then ctrl.value = ctrl.value + 1
next ctrl

exception list = {an unknown quantity of strings, or variants, or objects, that I wish to exclude from the above action}
 
You can use a parameter array. Like this:

Code:
Function MyFunction(frm As Form, ParamArray arrP() As Variant)
   Dim L As Long
   Dim ctl As Control
 
For Each ctl In frm.Controls
   For L = 0 To UBound(arrP)
      If arrP(L) = ctl Then
         ctl.Value = ctl.Value + 1
         Exit For
      End If
   Next
Next
 
 
End Function

That is air code (untested) and also it can depend on what you want to pass it as to whether some changes would be in order for it.
 
You could put a flag in the control's Tag property to include that control.

Chris.
 

Users who are viewing this thread

Back
Top Bottom