Mass label command

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devonknows
    New Member
    • Nov 2006
    • 137

    #1

    Mass label command

    hi,i have over 20 labels o m form and i was wondering is here any way tha you can send a mass command to get them all orjust certain ones for example


    Private Function MassLabel(sFrom as Form, sCommand as String, sValue as String, ParamArray aLabels() as Variant)

    thatworks when i use somehing like

    MassLabel frmMain, "Visable", "True", "lbl1", "lbl2", "lbl7", "lbl13", "lbl14", "lbl15"
    so that it would make lbl's 1,2,7,13,14 and 15 all visable at once, cus its just right annoyng whenyou have to type out label1.enable = false about 40 times
    so any help would be appreciated.
    Kind Regards
    Devon.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    For a start, it would probably be simpler if you put your labels in a control array. That way you can use loops to process them.

    Also, I see no reason why you couldn't create a Function/Sub the way you described. You could pass to it either the actual controls, or the indexes of the controls (assuming they're in an array as mentioned).

    Comment

    • devonknows
      New Member
      • Nov 2006
      • 137

      #3
      Originally posted by Killer42
      For a start, it would probably be simpler if you put your labels in a control array. That way you can use loops to process them.

      Also, I see no reason why you couldn't create a Function/Sub the way you described. You could pass to it either the actual controls, or the indexes of the controls (assuming they're in an array as mentioned).
      THanks for the help, i used an array to do it, much appreciated. Thank You

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by devonknows
        THanks for the help, i used an array to do it, much appreciated. Thank You
        Glad to help. :)

        Control arrays are a very powerful and useful feature. Unfortunately they were removed in VBA (built into Excel, etc) and VB.Net. :(

        Comment

        Working...