You only should use that syntax if you have the specific instances ready to
insert.
Instead use:
array<TextBox^^dialog_txb = gcnew array<TextBox^>(5);
and then when you have the instance of TextBox that you want in the array,
add them using standard array syntax (e.g., dialog_txb[0] =
some_specific_textbox, or dialog_txb[0] = gcnew TextBox() - obviously in a
loop if you have many that you're adding this way).
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI
"gmb" wrote:
(.NET 2.0)
code:
array<TextBox^^dialog_txb = {gcnew TextBox(),gcnew TextBox(),gcnew
TextBox(),gcnew TextBox(),gcnew TextBox()};
question:
Is there a shorter way to declare and initialize an array of 5 objects
without repetition of "gcnew TextBox()" ?
(What if I need to create an array with much bigger number of elements?)
Thanks in advance,
gmb