【发布时间】:2013-07-03 06:57:09
【问题描述】:
对不起,我认为这可能是重复的问题。我想是这样。好吧,我已经完成了 datagrid 列,它能够使用下面的代码进行排序,但我尝试对 lisview 进行排序,但它似乎不起作用。我想根据按钮单击而不是列单击对列表视图进行排序。这甚至可能吗?我试过这个来自 MSDN 的链接,但我不明白。 http://support.microsoft.com/kb/319399 下面是我对datagridview 进行排序的代码。是否可以将其应用于lisview?整数 i 是一个全局变量。
i += 1
Dim x As Integer = grdDataGrid.CurrentCell.ColumnIndex
If i Mod 2 = 1 Then
'sort up
grdDataGrid.Sort(grdDataGrid.Columns(x), System.ComponentModel.ListSortDirection.Ascending)
ElseIf i Mod 2 = 0 Then
'sort down
grdDataGrid.Sort(grdDataGrid.Columns(x), System.ComponentModel.ListSortDirection.Descending)
【问题讨论】:
标签: vb.net listview columnsorting