List of Label in a Windows Form Application

Hi everybody !!

I actually have 2 questions to ask here (that belong together)

I'm writing a Windows Form Application with Visual C++ 2005, and I was wondering if anyone knows how to create a list of labels in there ??

I would like to create a list to manage the capacities of a flow network, in a better way than label1->Text=..., label2->Text=..., label3->Text=...
Is there a way do an iteration ? Like : for(...) Label[i]->Text=...

I tried to look in the Code (Form1.h) how those Labels are declared, hoping to create a pointer, but instead I found this :
1
2
3
4
System::Windows::Forms::Button^     initBtn;
System::Windows::Forms::GroupBox^   groupBoxGraphe;
System::Windows::Forms::Label^      labelCapRes;
System::Windows::Forms::PictureBox^ pictureBoxGrapEc;

And here comes the second question :
Does anyone know what this symbol means '^' ???
Becaus I did find something about the variable that is pointed by the pointer... but in Pascal !! And I'm working in C++ here... -_-

Thanks in advance for your answers.
Last edited on
closed account (z05DSL3A)
Does anyone know what this symbol means '^' ?..And I'm working in C++ here...

No, you are doing C++/CLI, the ^ is a 'handle' to access .NET reference types.
Ok thank you, that also explains the gcnew (that I wasn't familiar with) instead of new().
I just wanted to create a small application for a school project, not learn a new language ^^

And do you know if it is possible to create a list ?
Something like :

1
2
3
System::Windows::Forms::Label^  label;

this->label = gcnew System::Windows::Forms::Label()[sizeOfList]
closed account (z05DSL3A)
It would be somthing like

1
2
3
4
5
array<Label^>^ arr = gcnew array<Label^>(10);

for each(Label^% lbl in arr)
        lbl->Text=...;


NB: I don't realy do C++/CLI I don't like it that much.
Topic archived. No new replies allowed.