Solved

Variable label name

Posted on 2003-10-30
10
192 Views
Last Modified: 2010-05-01
I am attempting to display an array by using labels.  However, I need to be able to use a variable within the label name to know what to display.

For example:

         For i = 1 to intNumNodes
                ToNode(i) = intValue
         Next i

        lblNode(i).caption = intValue     <---------- This is the problem

I have labels named lblNode1, lblNode2, etc.

I appreciate any helped provided.

Thanks,
Jeff

0
Comment
Question by:bowen18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
10 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 9651024
What type is IntValue?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9651067
For i = 1 to intNumNodes
                ToNode(i) = intValue
         Next i
for i = 1 to Innumnodes
        lblNode(i).caption = intValue    
next i
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9651069
For i = 1 to intNumNodes
                ToNode(i) = intValue
         Next i

 for i = 0 to Innumnodes - 1
        lblNode(i).caption = intValue    
next i
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 2

Author Comment

by:bowen18
ID: 9651100
IntValue is an integer.  However, the problem is with the lblNode(i).caption line.  VB doesn't accept that as a valid label name.  Is there some way to include the varible i within the label name?
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 500 total points
ID: 9651106
You could use an array of labels!! matching some like this:

  For i = 1 to intNumNodes
                lblNode(i).caption  = ToNode(i)
 Next i

Or see CallByname function in MSDN Help.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 9651159
Are yo using .NET ?? if so
try lblnode.Text = whatever
0
 
LVL 2

Author Comment

by:bowen18
ID: 9651170
Using version 6.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9651193
Well, it appears to be a "two-way only" thread so, good luck!.
Cheers
0
 
LVL 2

Author Comment

by:bowen18
ID: 9651215
-Richie_Simonetti

Thanks I'm using your suggestion with the label array.  Never used it before, but makes perfect sense in this case.

Thanks,
Jeff
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9651282
Array of controls use less resources than using label1, label2, label3 and so on.
You could use array of each vb intrinsic controls and almost all ocx.
Cheers ... again.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

729 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