I've created a class PulldownArray, which contains two strings Value and Description. I created an array of this class called PulldownTABLE with the ArrayList^ command in my main program and I then populate it with the .Add method. All this works fine.
How do I retrive the Value and Description strings for an individual item in PulldownTABLE?
public ref class PulldownArray{
public:
String^ myValue;
String^ myDescription;
public:
~PulldownArray(){
}
PulldownArray( String^ strValue, String^ strDescription ){
this->myValue = strValue;
this->myDescription = strValue + " \t " + strDescription;
}
property
String^ Value{
String^ get(){
return myValue;
}
}
property
String^ Description{
String^ get(){
return myDescription;
}
}
virtual
String^ ToString() override{
return this->myValue;
}
};
main{.....
String^ ReturnString;
ArrayList^ PulldownTABLE = gcnew ArrayList;
PulldownTABLE->Add(gcnew PulldownArray("TABLE1", "TABLE1_description"));
PulldownTABLE->Add(gcnew PulldownArray("TABLE2", "TABLE2_description"));
//Works, but I don't want to have to write overrides for every element
ReturnString = PulldownTABLE[1]->ToString();
//Can see both myDescription and Description in the debugger but these both fail at compile
ReturnString = PulldownTABLE[1]->myDescription;
ReturnString = PulldownTABLE[1]->Description();
...
}
Any help would be appreciated but please keep it simple as I'm particularily stupid and ignorant.