R
Randy Hersom
In C++ using Windows Forms, how do you declare, and then size, a
multidimensional array property whose size is determined at runtime?
I've been through several permutations and haven't been able to get it to
compile without error. What combination of declaration and runtime sizing
will allow me to accomplish this?
The line just below the ellipsis (...) is what's breaking. Here's my latest
failure:
private: System::Array * originalSizes;
....
this->originalSizes =
Array.CreateInstance(typeof(this->Controls->Item(z)->Top) ,
{this->Controls->Count,4});
for (int z=0;z<this->Controls->Count;z++) {
this->originalSizes[z,0]=this->Controls->Item(z)->Top;
this->originalSizes[z,1]=this->Controls->Item(z)->Left;
this->originalSizes[z,2]=this->Controls->Item(z)->Height;
this->originalSizes[z,3]=this->Controls->Item(z)->Width;
}
multidimensional array property whose size is determined at runtime?
I've been through several permutations and haven't been able to get it to
compile without error. What combination of declaration and runtime sizing
will allow me to accomplish this?
The line just below the ellipsis (...) is what's breaking. Here's my latest
failure:
private: System::Array * originalSizes;
....
this->originalSizes =
Array.CreateInstance(typeof(this->Controls->Item(z)->Top) ,
{this->Controls->Count,4});
for (int z=0;z<this->Controls->Count;z++) {
this->originalSizes[z,0]=this->Controls->Item(z)->Top;
this->originalSizes[z,1]=this->Controls->Item(z)->Left;
this->originalSizes[z,2]=this->Controls->Item(z)->Height;
this->originalSizes[z,3]=this->Controls->Item(z)->Width;
}