[英]cannot implicitly convert type string to System.Windows.Forms.Datagridviewcell c#
[英]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.