Solved

Variable label name

Posted on 2003-10-30
10
170 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
  • 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
to transfer string from C lanaguage to VBA 4 64
Adding to a VBA? 6 70
Prevent checkbox click event occur while editing it in vb6 8 45
Send outlook email from VBS Script 2 29
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

770 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