[英]Value of type 'double' cannot be converted to 'System.Windows.Forms.DataGridViewCell
I want to show a list in DataGridView but the error says: 我想在DataGridView中显示一个列表,但错误显示:
Cannot implicitly convert type double to
System.Windows.Forms.DataGridViewCell
.无法将double类型隐式转换为
System.Windows.Forms.DataGridViewCell
。
What should I do? 我该怎么办?
for (int i = 0; i < nlength; i++)
{
if (i % 2 == 0) data_result.Rows[i].Cells[0] =U[2 * i];
}
You have to set the value of the cell, not the cell itself. 您必须设置单元格的值,而不是单元格本身。 Look at this msdn article for more information
查看此msdn文章以获取更多信息
data_result.Rows[i].Cells[0].Value = U[2 * i];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.