【发布时间】:2012-02-27 07:26:49
【问题描述】:
我正在使用 this answer 中的代码读取 CSV 文件,并且我想将 const CSVRow& row 值分配给表单控件(例如 ListBox)。我怎样才能做到这一点?
这是我要更改的代码:
void display(const CSVRow& row)
{
if(!row.size()) return;
CSVRowCI i = row.begin();
std::cout << *(i++);
for(; i != row.end(); ++i)
std::cout << ',' << *i;
}
但我想做的不是std::cout << ',' << *i,而是:
this->ListBox1->Items->Add(*i);
我尝试使用*i.ToString(),但它给了我一个错误:
无法将 const std::basic 字符串转换为 System::String
【问题讨论】: