I have developed an application which requires sorting of information based on all the headers. So i am interested to know how to sort the grid view when a header of the column is pressed. It will be my pleasure if someone could help me in this aspect and provide me with an appropriate code.


You can play with following properties such as "SortedColumn", "SortOrder" and "Sort" method in datagridview. gridview will have the sort order (suppose columns are added by datasource) by default.

Just give a try and let us know if any help is needed.