【发布时间】:2010-10-18 12:59:12
【问题描述】:
我想使用 datagridview 向用户显示一些数据(信息)。我的 datagridview 有 4 列。当我使用此代码时
private void sfactor_Load(object sender, EventArgs e)
{
dataGridView1.Rows[0].Cells[0].Value = "book";
dataGridView1.Rows[1].Cells[0].Value = "pen";
dataGridView1.Rows[2].Cells[0].Value = "x";
dataGridView1.Rows[3].Cells[0].Value = "y";
dataGridView1.Rows[4].Cells[0].Value = "z";
}
我想在column[0] 中显示此信息。程序运行时出现异常:
Index was out of range.
Must be non-negative and less than the size of the collection.
Parameter name: index
我知道为什么,但我不知道如何解决它。现在我需要你的帮助和你的经验。我等着你的回答。
【问题讨论】:
标签: c# datagridview