Issue:
- You are looking for DataRow in DataGrid.
- You are not using DataRow inside the loop.
Problem can be seen here in this loop:
foreach (DataRow renglon in DivDup.dtgGrid.rows)
{
}
This can be done like this:
foreach (DataRow renglon in ds.Tables[0].Rows)
{
//here you can use renglon
}
Here is how you could traverse through datagrid:
int rowCount = ds.Tables[0].Rows.Count;
int colCount = ds.Tables[0].Columns.Count;
for(int row = 0; row < rowCount; row++)
{
for(int col = 0; col < colCount; col++)
{
arregloGrid[row, col] = DivDup.dtgGrid[row, col].ToString();
}
}
Please note above code is not tested.