N
netloss
My program grabs a single datatable (dt) from an Excel file, loads it
into a dataset (ds) and displays it in a datagrid (dg).
The datatable has a couple of "calculated" columns that start out
blank. After loading the datattable, the program fills in these blank
columns using the values in other columns.
Next, I want to re-sort the datatable using the "calculated" columns. I
use the following code:
Ds.dt.DefaultView.Sort = "calculatedcol1, calculatedcol2"
Dg.DataSource() = ds.dt
This causes the datagrid to sort the datarows correctly. HOWEVER, I
also want to declare a loop that goes through each datarow in the
datatable and does something with that datarow. It's important that the
datarows are sorted as shown in the code. However, when I do the loop,
it's clear that the underlying datatable has not actually been
re-sorted.
My question is this: Is it possible either to re-sort the actual
underlying datatable, OR is it possible to somehow loop through each
value of the DefaultView instead of the table itself?
Thanks!!!!
into a dataset (ds) and displays it in a datagrid (dg).
The datatable has a couple of "calculated" columns that start out
blank. After loading the datattable, the program fills in these blank
columns using the values in other columns.
Next, I want to re-sort the datatable using the "calculated" columns. I
use the following code:
Ds.dt.DefaultView.Sort = "calculatedcol1, calculatedcol2"
Dg.DataSource() = ds.dt
This causes the datagrid to sort the datarows correctly. HOWEVER, I
also want to declare a loop that goes through each datarow in the
datatable and does something with that datarow. It's important that the
datarows are sorted as shown in the code. However, when I do the loop,
it's clear that the underlying datatable has not actually been
re-sorted.
My question is this: Is it possible either to re-sort the actual
underlying datatable, OR is it possible to somehow loop through each
value of the DefaultView instead of the table itself?
Thanks!!!!