Share via

Visual Basic - Datagridview - Get Current sort direction for a specific datagridview column

Anonymous
2016-09-07T16:43:09+00:00

I have a Visual basic Windows desktop application that uses a datagridview that is loaded with data from a data array.

I sort the first column using the code.

DataGridViewCashFlowSource.Sort(DataGridViewCashFlowSource.Columns(0), System.ComponentModel.ListSortDirection.Descending)

But I also allow want to allow the user to be able to manually change the sort order.

At one point it is important for me to know what direction the sort is before I action the selected option.

As there is only one column that is being sorted it appears that I can use the following to determine the sort order:

If DataGridViewCashFlowSource.SortOrder = SortOrder.Ascending Then

But if I had two columns that could be sorted differently how can I determine the sort order for a specific datagridview column?

Any advice would be much appreciated.

Windows for home | Other | Install and upgrade

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2016-09-07T20:46:31+00:00

    Hi,

    Your question is outside the scope of this Community..

    Kindly repost in the TechNet Forums:

    https://social.technet.microsoft.com/Forums/en-US/home

    Or MSDN Forums:

    https://social.msdn.microsoft.com/Forums/en-US/home

    Cheers.

    Was this answer helpful?

    0 comments No comments