Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 534
  • Last Modified:

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.

thanks
0
replyanshu
Asked:
replyanshu
  • 2
1 Solution
 
Bob LearnedCommented:
How are you "checking" for column order?  Are you just looping through the columns, or are you checking a property value?
0
 
replyanshuAuthor Commented:
yes looping through the columns
0
 
Bob LearnedCommented:
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.

Reference:

How to: Change the Order of Columns in the Windows Forms DataGridView Control
http://msdn.microsoft.com/en-us/library/wkfe535h.aspx
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now