Link to home
Start Free TrialLog in
Avatar of svenkatapuram
svenkatapuram

asked on

passing name of control Array to a Routine

I need to pass a name of controlArray to a Routine, so that i do not have to repeat the code every time i am using to set some of the  controlArray properties

Whe i tried to do this i am getting an error message "Invalide property  Assignemnet"

My code looks like this:

This is my control Array click event:
Private sub lblTemp_Click(Index as Integer)
    DoSomething lblTemp, Index
End Sub

This is the routine where i want to pass the control array name:
Private Sub Procedure DoSomething(lblLabel as Label, _
      idx as Integer)
      lblLabel(idx).caption = "Hello World"
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
D00D try this

Private Sub lblTemp_Click(Index As Integer)
DoSomething lbltemp(Index)
End Sub

Private Sub DoSomething(lblLabel As Label)
lblLabel.Caption = "Hello World"
End Sub

you have to pass the label with its index because just the label name refers to no specific label
Avatar of psmith789
psmith789

Have you tried defining
DoSomething(lblLabel as Object, ....

and/or calling the application by using
  DoSomething lblTemp(Index), Index
Avatar of svenkatapuram

ASKER

Thanks,

it did work