[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

passing name of control Array to a Routine

Posted on 1999-11-16
4
Medium Priority
?
180 Views
Last Modified: 2012-05-07
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
0
Comment
Question by:svenkatapuram
4 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 150 total points
ID: 2211370
Try 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 DoSomething(lblLabel, idx As Integer)
      lblLabel(idx).Caption = "Hello World"
      lblLabel(idx).BackColor = vbRed
End Sub

0
 
LVL 13

Expert Comment

by:crazyman
ID: 2211390
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
0
 
LVL 1

Expert Comment

by:psmith789
ID: 2211409
Have you tried defining
DoSomething(lblLabel as Object, ....

and/or calling the application by using
  DoSomething lblTemp(Index), Index
0
 

Author Comment

by:svenkatapuram
ID: 2211961
Thanks,

it did work
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question