Click here to Skip to main content
15,669,040 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i have a datatable with five columns a want to reverse the ordinal of the columns
in this table ... i used this loop but it did not work
VB
dim dt as new datatable
'here we add the columns col1,col2,...col5
dim x as integer = dt.columns.count
for i as integer = 0 to mydatatable.columns.count -1
dt.columns(i).setordinal(x-1-i)
next

when the iteration reaches the middle of the columns number it turns back
the reversed columns to its original ordinal.
Posted
Comments
Mehdi Gholam 22-Apr-12 8:27am    
Why do you want to do such a thing? Usually this is done on the UI in a grid view not on the data source.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900