<sadun> wrote:
this->user_information->Text =
this->query->SList[this->listBox1->SelectedIndex];
sList is a SortedList i want to reach its valur by its index ??? i got this
error
error C2845: '[' : cannot perform pointer arithmetic on __gc pointer
'System::Collections::SortedList __gc *'
Try using the Item method, e.g.
a->Item[n];
The problem is that the current incarnation of Managed C++ represents
objects of reference types as pointers, for which operator[] already has a
meaning in C++. Though it's disallowed for managed pointers, it's still part
of the language, hence the error message. Unfortunately, this messiness
means Managed C++ currently doesn't support the nice indexer syntax you have
in other languages. This problem is addressed in the upcoming Whidbey
compiler, which provides many improvements in the Managed C++ syntax.
--
Doug Harrison
Microsoft MVP - Visual C++