Link to home
Create AccountLog in
Avatar of Chrysaor
Chrysaor

asked on

Integers problem

Let's say I have the integers A1,A2,A3 .....Ax, and the integer x.

I want when the value of x is 2 (for example) , the caption of a label to return A2's value. If x = 3, to return A3 value and so on. How do I do that? (Without having to write manually each time if x= 2, label->caption = A2 etc, but automatically to return Ax value)

Thanks a lot.
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See the reference to the AnsiString class at http://thunder.prohosting.com/~cbdn/pg_013.htm - you can do that like
AnsiString str;
int x = 2;
 
str = "A" + IntToStr(x);
 
label->caption = str;

Open in new window

SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.