【问题标题】:Sort a column in Listview Vb.net?对 Listview Vb.net 中的列进行排序?
【发布时间】: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


    【解决方案1】:

    查看以下帖子中的答案:

    Sorting A ListView By Column

    他们给你几个例子,但他们也推荐ObjectListView 谁会让你的工作更轻松:

    A Much Easier to Use ListView

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-08
      • 1970-01-01
      • 1970-01-01
      • 2015-12-25
      • 1970-01-01
      • 2020-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多