I have a 2D array. I want to print the array in my DataGridView
but it throws an error:
[Argument OutOfRangeException was unhandled ]
This is my code
for (int j = 0; j < height; j++)
{
for (int i = 0; i < width; i++)
{
dataGridView1[i, j].Value = state[i, j].h;
//state[i, j].h this is my array
dataGridView1[i, j].Style.BackColor pixelcolor[i,j];
dataGridView1[i, j].Style.ForeColor = Color.Gold;
}
}