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
  • 165,109
  • 17
  • 150
  • 199
imrdnck
  • 197
  • 2
  • 2
  • 9

0 Answers0