繁体   English   中英

类型“ double”的值不能转换为“ System.Windows.Forms.DataGridViewCell”

[英]Value of type 'double' cannot be converted to 'System.Windows.Forms.DataGridViewCell

我想在DataGridView中显示一个列表,但错误显示:

无法将double类型隐式转换为System.Windows.Forms.DataGridViewCell

我该怎么办?

for (int i = 0; i < nlength; i++)
{
    if (i % 2 == 0) data_result.Rows[i].Cells[0] =U[2 * i];
}

您必须设置单元格的值,而不是单元格本身。 查看此msdn文章以获取更多信息

data_result.Rows[i].Cells[0].Value = U[2 * i];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM