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
Todd Vance
NA
60
131.6k
How to put a variable in the Properties.Resources."image" line.
May 30 2007 10:30 PM
Hey all,
Last night I was asking how best to add a resource and was given this good advice
"By adding the image files to your resources, you can limit the code needed to display the image to something like this:
pbxCard.Image = Properties.
Resources
.HeartsQueen;"
But my issue I have now is that I wanted to fill these boxes with Random images chosen by an array.
In other words I want something like pbxCard1 to be the
myDeck.cards[0].ToString + ".jpg"
image.
By adding my images to the resources like I was told all my images which were named 1 and 2 and 3.jpg (etc.) get their names changed to _1 and _2 and _3 -- so I somehow need to get the number out of the array and then concatenate it to the end.
NOW I KNEW THIS wouldn't work -
pile1image1.Image = Properties.
Resources
._ + mydeck.card[0].ToString;
but it is in essence what I want to do -- can someone tell me how to do it?
============
ALSO I cant do this:
string
image1 =
"Properties.Resources._"
+ myDeck.cards[0];
because when I try and place it into the pile1image1.Image = image1 line - it tells me that I cannot convert a string to an image.... help???
Reply
Answers (
2
)
calculating a future date?
First C# Program- Need a Little Help