PDA

Click to See Complete Forum and Search --> : Does This Exsist In C++?


Vlatko
Sep 29th, 2000, 03:21 PM
I want to know if it is possible to make control arrays in VC++ like in VB.
Ex.textbox(1),textbox(2)
And if it is possible - HOW?

parksie
Sep 29th, 2000, 05:11 PM
Not as such, since C++ doesn't have any mechanisms for doing it (it is non-visual by default). Although, you can do something like this:

long plTextBoxes[] = {IDC_TEXT1, IDC_TEXT2};

SendMessage(GetDlgItem(hWnd_Main, plTextBoxes[1]), ...);

Although you could always use a vector or list if you needed to dynamically allocate them.
If you're using MFC then there is a (tricky) way to do it, but it needs to be tailored exactly to your project, since there is no generic method.