I'm trying to display the 2d array in datagridview. Im generting data via Windows Form into 2d array and then trying to display that data into datagrid view but I get an error on line row.CreateCells(this.dataGridView1); Row provided already belongs to a DataGridView control. not sure what im doing wrong appreciate if anyone please put me on the right direction Code is below
iArray = new String[2, 10];
iArray = custDetails.pCustomDetails();
int height = iArray.GetLength(0);
int width = iArray.GetLength(1);
MessageBox.Show(height.ToString());
MessageBox.Show(width.ToString());
this.dataGridView1.ColumnCount = width;
for (int r = 0; r < height; r++)
{
row.CreateCells(this.dataGridView1);
for (int c = 0; c < width; c++)
{
row.Cells[c].Value = iArray[r, c];
}
this.dataGridView1.Rows.Add(row);
}