I met a problem that I’m using for each to loop my DataRow.
During the loop, it’ll assign Date when it sees the specific value.
I knew that it shouldn’t use “item” as a target to assign, it should use DataRow with the index of ItemArray instead.
But whenever I tried, the value still the same.
Could anyone tell me the reason and how to solve the problem?
Hi, does the ColIndex value is static or dynamic because i can’t see it in the example. If i understand correctly you are always filling last row in the table isn’t it ? What value are not filled then ?
Then can you share with us what values stay constant ? Lets say that row has 10 columns, are you having same data in whole colums ? Is that row is already empty or it has some data ? Share more details.
It’s a summary file that it has over 100 columns and the last row are the information of SUM value of each column.
I used for each to get rid of the empty columns that some of them are not amount, but other content.
And the last thing I’m doing at the present is just one cell that I need to change a value of cell “Total” to the “Date” the file released.
The cell of “Total” is in the Column Index 0. Even I tries to assign it directly “TestDT.Rows(TestDT.Rows.Count - 1).ItemArray(0) = 20190910”, it still shows me “Total”.
I tried to use “For each Row” instead of “For each” which makes me feel weird and wrong. But it could change the value when I assign it.
But still don’t understand why the “for each row” can achieve it, but “for each” can’t.
I want to know the reason or probably what detail i didn’t notice.