myWarcraftRace->removeSkill( sysStringToCharArray( listBox_mySkills->SelectedItem->Text ) );
syStringToCharArray() does work, also the removeSkill() does work, problem is that I can’t get the Text value of listBox_mySkills->SelectedItem
If I do as I did above, it gives me error:
1>d:\programming\vc++ projects\wcrace maker\MainForm.h(194): error C2872: 'Text' : ambiguous symbol
1> could be 'System::Drawing::Text'
1> or 'System::Text'
1>d:\programming\vc++ projects\wcrace maker\MainForm.h(194): error C2882: 'Text' : illegal use of namespace identifier in expression
And if I’ll try to use it without text, it gives me error:
1>d:\programming\vc++ projects\wcrace maker\MainForm.h(194): error C2664: 'sysStringToCharArray' : cannot convert parameter 1 from 'System::Object ^' to 'System::String ^'
Which it obliviously is supposed to do, cause sysStringToCharArray() takes System::String^ parameter. So Problem is that I’m unable to use the Text property of the listbox item, anyone have any ideas why’s that?
You are not getting a great error message here. The real problem is the type of the ListBox::SelectedItem property. It is Object, a listbox can store any kind of value or object. And Object doesn’t have a Text property. The compiler now goes noddy when hunting for the “Text” identifier and finding a match in namespace names, more than one. Fix: