开发者

Argument OutOfRangeException C# DataGridView

i have an argument outofrangeexception for my datagridview.

i try to fill it. It stops when i = 1;

I dont know where is my mistake but its not the array donnee[,]

here's my code

 for(int i = 0; i < donnee.Length/4; i++){
                    dataGridView1.Rows[i].Cells[0].Value = donnee[i,0];
  开发者_StackOverflow社区                  dataGridView1.Rows[i].Cells[1].Value = donnee[i,1];
                    dataGridView1.Rows[i].Cells[2].Value = donnee[i,2];
                    dataGridView1.Rows[i].Cells[3].Value = donnee[i,3];
                }//REMPLIR DATAGRIDVIEW

Thanks


If you are filling it, you need to add rows as you go. I expect that you are currently filling the default "new data" row (as zero), but you should really be allocating your own each time, simply via .Rows.Add(). You could do this per-row, or via dataGridView1.Rows.Add(donnee.Length/4); before the loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜