簡體   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