Click here to Skip to main content
16,021,979 members

Comments by epdoce (Top 1 by date)

epdoce 13-Jul-17 1:32am View    
foreach (string ColumnN in list)
{
table.Columns.Add(ColumnN, typeof(string));
}
this is wrong...
As you see you used a loop to create columns in your table using the list items as your column name. Then in your next loop column "ColumnN" is unknown... your row will be out of index