Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Variable label name

Posted on 2003-10-30
10
Medium Priority
?
211 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

604 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