I have a datatable with nth column. Now, I want to change the index of some columns. Need help

Try this:

yDTable.Columns("IndexChangeColName").SetOrdinal(IndexYouWantingToChangeTo)

I'm not sure about this, but this will change the position of your column and is there're multiple columns to change - like n columns, etc... - you must use this line n times to change all the columns' position.

yDTable.Columns("IndexChangeColName(1)").SetOrdinal(IndexYouWantingToChangeTo(1))
....
yDTable.Columns("IndexChangeColName(n)").SetOrdinal(IndexYouWantingToChangeTo(n))

Thanksk Eternal newbie C:

After Googleing, I just saw a solution that look like the same as yours, but still I appreciate your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.