2012-01-03 7 views
0

에서 checkedListBox에 필드를 추가하는 방법은 다음과 같은 코드를 작성했습니다 :은 WFA : <vector>

this->checkedListBox1->Items->Insert(0, "Copenhagen"); 
MyClass * tmp = new MyClasss(); 
std::vector <Element> AA = tmp->getAllEl(); 
Element mm = AA.front(); 
this->checkedListBox1->Items->Insert(1, mm.name); 

을하지만 그 날을 알려줍니다

cannot convert parameter 2 from 'std::string' to 'System::Object ^' 

가 어떻게 System::Object ^std::string을 변환 할 수 있습니까? 아니면 checkedListBox에 항목을 삽입 할 수 있습니까?

+0

은 '문자열'또는 '문자열'입니까? 나는 당신이'string'을 의미한다고 생각합니다! –

답변

0

std::stringSystem::String^으로 변환하고 System::String^을 전달해야합니다.

이것은 std::string에서 System::String ^을 만드는 방법입니다 :

String^S = gcnew String(mm.name.c_str()); 

이 그 다음을 전달합니다

this->checkedListBox1->Items->Insert(1,S); 

이 당신을 위해 작동합니다.