TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Michael Mortensen
NA
8
4.3k
Calling a label with a variable (SOLVED)
Feb 26 2014 7:33 AM
I will need to do a lot of similar coding for different labels, and I was wondering how to call a label without having it write it's name entirely, but using a variable.
I need to use a variable anyway, so I figured I would just call the labels something similar.
For instance: Variable Cookie needs to be 1100, and I, elsewhere, need to call the label associated with the number 1100. So let's say I call the label label1100.
the Cookie variable could also be 2200 or 2100 or 1400, and those have associated labels as well (label2200, label2100, label1400)
How do I call the associated label, without having to write the name of the exact label?
I'm thinking something like this (of course this won't work, this is just how it looks in my head):
Label TheLabel = (Label)"label" + Cookie;
TheLabel.Show();
Reply
Answers (
2
)
I had aswell planned to accommodated with Travis MCH the day
Calling a variable with a variable