C# -- DataGridView SortedColumn (DESC or acending) ?

finance_teacher
finance_teacher used Ask the Experts™
on
The below works.

            string vSortedColumn = Convert.ToString(this.gML_ROITEMDataGridView.SortedColumn.Name);

How can I also extract "SORT ORDER" (i.e. DESC or acending)
since the below just says "Automatic" all the time ?

            string vSortedColumn = Convert.ToString(this.gML_ROITEMDataGridView.SortedColumn.SortMode);
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Lead Software Engineer
Commented:
You can get the sort order using the SortOrder property of the data grid view.
this.gML_ROITEMDataGridView.SortOrder
See example on MSDN: http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.sortedcolumn.aspx

Author

Commented:
Thanks, the below displays "Ascending" & "Descending" text

           string vSortedColumn = Convert.ToString(this.gML_ROITEMDataGridView.SortedColumn.Name);
           string vSortedOrder = Convert.ToString(this.gML_ROITEMDataGridView.SortOrder);

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial