WFA:如何在复选框列表框中<vector>添加字段
WFA: How to add field in checkedListBox from <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 ^'
如何将std::string
转换为System::Object ^
?或者我如何在checkedListBox中插入项目?
你应该把你的std::string
转换成System::String^
,然后通过System::String^
,它将是可接受的。
这是如何从std::string
创建System::String ^
:
String ^ S = gcnew String(mm.name.c_str());
然后传递:
this->checkedListBox1->Items->Insert(1,S);
相关文章:
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- 在c++中用vector填充一个简单的动态数组
- vector.resize()中的分配错误
- 使用std::vector的OpenCL矩阵乘法
- POCO::PostgreSQL:如何将std::vector支持添加到`Binder::bind`
- 在某些循环内使用vector.push_back时出现分段错误
- 当vector是tje全局变量时,c++中vector的内存管理
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- std::vector的包装器,使数组的结构看起来像结构的数组
- 呼叫运营商<<临时
- 为什么(-1)%vector::size()总是返回0
- 如何防止clang格式在流运算符调用之间添加换行符<<
- 在C++中将类(带有Vector成员)保存为二进制文件
- 编译器如何区分std::vector的构造函数
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- 错误:调用"std::vector<:vector<int>>::p ush_back(std::vector<std::__cxx11::basic_string<
- std::vector::reserve(未知m),我知道m<<;N(通常)并且知道N
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- C++重载<<具有typedef'd std::vector
- std::映射<>或std::vector<>在处理大型标志集时