Variable in name

hi im making blackjack in c++ and i was wondering if it is possible to put a variable in the name of a picture box for example:
i = 1;

Is this possible?
You'd need to provide a bit more information. You can't have variables be part of an identifier name and have them be replaced, but you can use variables in expressions like you are up there. The only issue I see is that "2c" isn't a valid name because it starts with a number.
From your code alone, I'm assuming that pictureBox is a pointer a pointer who's type contains a member function called "Load".

I'm also assuming that 2c is a type and gif is another type who's a member of 2c
To me it looks like 2c.gif is referring to an image file. Just guessing.
closed account (o1vk4iN6)

This is not C++. This is .Net tacked onto C++. Just use C#.
I think you are all misunderstanding him. (But I could be wrong.) This is actually a common question.

std::string filename = "2c.gif";

Are you using the CString class instead? How are you storing your variable name?
If that is the case then why not?

closed account (o1vk4iN6)
It's .Net, it takes "String" (managed) as a parameter. Not sure about the implicit conversions but i'd imagine it'd be compatible with std::string.
You all understood it very wrong! He meant this:
pictureBox[i]->Load(/*the value of the variable 2c*/".gif");
It is possible if the value of that variable is a std::string:
But, of course, the name of the variable cant start with a number!
Topic archived. No new replies allowed.