Datagridview column reorder problem

hi all,

i have implemented a datagridview with column reorder functionality. it is working fine, like a am able to drag and drop columns whereever i want them.
now the problem arises when i put a for loop to check the current position of columns, the current position is still unchanged i.e. i put II nd column to the position of iV th column but still i get column 2 at IInd position.

Column reorder doesn't affect the actual column position.

any sort of help would be appreciated.

Who is Participating?
Bob LearnedConnect With a Mentor Commented:
If you are just looping through the columns, they will be returned in the order they are defined.  If you want to check the display position with the DisplayIndex property.


How to: Change the Order of Columns in the Windows Forms DataGridView Control
Bob LearnedCommented:
How are you "checking" for column order?  Are you just looping through the columns, or are you checking a property value?
replyanshuAuthor Commented:
yes looping through the columns
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.