Hi all,

Currently, i'm having a window to show rows of data. the following is for 1st row:

a0_1->Text = "blah,blah";
b0_1->Text = "blah,blah";
c0_1->Text = "blah,blah";
d0_1->Text = "blah,blah";
e0_1->Text = "blah,blah";
...............

And as for the 2nd row, its just a change for the last integer of the "a0_x" as shown in the following.

a0_2->Text = "blah,blah";
b0_2->Text = "blah,blah";
c0_2->Text = "blah,blah";
d0_2->Text = "blah,blah";
e0_2->Text = "blah,blah";
...............

I have completed the function for the 1st row but to carry on with the 2nd, 3rd to 20th rows is just a repeat of 1st row. I would appreciate if someone can give some suggestions on what to used so i can do the following. Then i dont need to change every last integer of the label pointers.

//maybe like --->
int zeropointers (int pNum)
{
a0_pNum->Text = "blah,blah";
b0_pNum->Text = "blah,blah";
c0_pNum->Text = "blah,blah";
d0_pNum->Text = "blah,blah";
e0_pNum->Text = "blah,blah";
return 0;
}
//so when reach the 5th row i can just change pNum to 5 and so on.

Recommended Answers

All 4 Replies

When you find yourself using names like xxx0, xxx1, xxx0_1, xxx2_1, etc..., you should probably be using an array instead.

When you find yourself using names like xxx0, xxx1, xxx0_1, xxx2_1, etc..., you should probably be using an array instead.

Thanks for your reply.

if possible, can i have some example for the array from the above example.

Thank in advance.

I imagine that std::string table[ROWS][COLS]; would be sufficient. If not, you should read up on C++ a bit.

>Thank in advance.
FYI, this is an extremely rude and condescending statement. I'm sure you meant it with the best of intentions, but it's tax collector speak for "I'm just being polite because you WILL comply immediately whether you like it or not."

I imagine that std::string table[ROWS][COLS]; would be sufficient. If not, you should read up on C++ a bit.

>Thank in advance.
FYI, this is an extremely rude and condescending statement. I'm sure you meant it with the best of intentions, but it's tax collector speak for "I'm just being polite because you WILL comply immediately whether you like it or not."

Sorry for that statement, i will read up on your suggession.

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.