.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> DataGrid >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Enable disable reorder column in datagridview in windows form

Posted By:Amit Mehra       Posted Date: May 15, 2013    Points: 40    Category: DataGrid    URL: http://www.dotnetspark.com  

This code example will allow user to enable disable reorder or rearranging column in datagridview in windows application.

AllowUserToOrderColumns property of the DataGridView give user flexibility to arrange the column order in what they want to view data.

If you want that user can re arrange the column at set this AllowUserToOrderColumns of the DataGridView to true.

Similarly if you want user to restrict not to change the column order set this property to false.

Code sample in C#

myDataGridView.AllowUserToOrderColumns = true; //myDataGridView is my DataGridViewName

Note: by default its true only.


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend