0

I am trying to pull Excel data to an array and I keep receiving this error any help would be great.

Thanks.

string[,] Datavalue = new string[dataGridView1.Rows.Count,dataGridView1.Columns.Count];

foreach(DataGridViewRow row in dataGridView1.Rows)
{
    foreach(DataGridViewColumn col in dataGridView1.Columns)
    {              
        Datavalue[row.Index, col.Index] =
          dataGridView1.Rows[row.Index].Cells[col.Index].Value.ToString();

enter image description here

Dmitry Bychenko
  • 180,369
  • 20
  • 160
  • 215
imrdnck
  • 287
  • 2
  • 3
  • 9

0 Answers0