Create a table
-
Hi, I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200); i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array^ subItems=gcnew array(16); Thank you verry mutch
-
Hi, I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200); i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array^ subItems=gcnew array(16); Thank you verry mutch
I don't understand what you're trying to do, but I see right away that you're trying to create a 3 dimension array with only two arguments in the constructor. What happened to our previous thread? I thought you needed an array of arrays... Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I don't understand what you're trying to do, but I see right away that you're trying to create a 3 dimension array with only two arguments in the constructor. What happened to our previous thread? I thought you needed an array of arrays... Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi, they are always an exception, how i can add in table of arrays, i do : tab[i][j]=Subitem; Thank you verry mutch
tab needs to be defined to hold the type that subitem is. You didn't show what subitem is in your first post. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
tab needs to be defined to hold the type that subitem is. You didn't show what subitem is in your first post. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi, I would create a table who every cas was : array < String ^, 2 > ^ tab=gcnew array < String ^, 2 > (20, 200); i try for array < String ^, 3 > ^ tab=gcnew array < String ^, 3 > (20, 200);, i can't make : tab[1][2]= subItems when array^ subItems=gcnew array(16); Thank you verry mutch
-
That's not valid. Your arrays need to have a type. What do you want to do? Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
you've created a rectangular multidimensional array rather than a jagged one. As such, you need to access elements like this
tab[i,j]
rather thantab[i][j]
(which you would do for a jagged array in C++/CLI)i try for : array < String ^, 3 > ^ sub2=gcnew array < String ^, 3 > (20,100,200); array^ subItems=gcnew array(16); subItems[0]="1"; subItems[1]="2"; . . subItems[15]="14"; sub2[0,0] = subItems but they are an error : Error 80 error C3262: invalid array indexing: 1 dimension(s) specified for 3-dimensional 'cli::array ^' Thank's
-
abbd wrote:
array < String ^, 3 > ^ sub2=gcnew array < String ^, 3 > (20,100,200); array^ subItems=gcnew array(16); sub2[0,0] = subItems
You have a bunch of things wrong here. Do you have an understanding of C++ arrays? They are strongly typed, like the whole language is. To define an array you have to specify a type - this won't work: array^ subItems=gcnew array(16); Now to add this array type to your multi-dimension array, that multidimensioned array must be defined to hold an array type - the type of subItems, which you haven't defined. If you have an array with three dimensions then you must access members of the array using three arguments. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
i try for : array < String ^, 3 > ^ sub2=gcnew array < String ^, 3 > (20,100,200); array^ subItems=gcnew array(16); subItems[0]="1"; subItems[1]="2"; . . subItems[15]="14"; sub2[0,0] = subItems but they are an error : Error 80 error C3262: invalid array indexing: 1 dimension(s) specified for 3-dimensional 'cli::array ^' Thank's
:confused: Are you trying to do something like this:
array<array<String^>^, 3>^ sub2 = gcnew array<array<String^>^,3>(10, 10, 10);
array<String^>^ subitems = gcnew array<String^>(15);
subitems[0] = "one";
subitems[1] = "two";
sub2[0, 0, 0] = subitems;
Console::WriteLine(sub2[0, 0, 0][0]);"We make a living by what we get, we make a life by what we give." --Winston Churchill