How do I create an array of objects?
I have 21 text boxes that need to be filled from 7 class objects. I want to step through the objects in sequence, check the value of a member variable, and if that is true, display the name in the box.
Is this something I need to use pointers for? What is the syntax for declaring and accessing the array?
I am writing a Windows Form in VC++2008
The class I want to use is below.
1 2 3 4 5 6 7
|
ref struct block{
System::String^ name;
System::Boolean enabled1;//Enabled on the first loop
System::Boolean enabled2;//Enabled on the second loop
System::Boolean enabled3;//Enabled on the third loop
System::Int32 sequence;
System::Int32 length;};
|
So, in the object "Union", I want to check if enabled1 is true. If so, then set
this->box1->Text=Union.name
. If not, check "High"; if
High.enabled1==true
, then
this->box1->Text=High.name
,etc. Then, repeat the cycle at TextBox8 and following.
Thank you.