1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | Private Sub lvwSort(lvw As ListView) Dim nums(lvw.Items.Count - 1) As Integer Dim numss(lvw.Items.Count - 1) As Integer Dim strs(lvw.Items.Count - 1) As String Dim strss(lvw.Items.Count - 1) As String Dim iLp As Integer For iLp = 0 To lvw.Items.Count - 1 nums(iLp) = CType(lvw.Items(iLp).Text, Integer) numss(iLp) = CType(lvw.Items(iLp).Text, Integer) strs(iLp) = CType(lvw.Items(iLp).SubItems(1).Text, String) strss(iLp) = CType(lvw.Items(iLp).Tag, String) Next iLp Array.Sort(nums) lvw.Items.Clear() Dim lvwi As ListViewItem For iLp = 0 To nums.GetUpperBound(0) For jLp = 0 To numss.GetUpperBound(0) If nums(iLp) = numss(jLp) Then lvwi = lvw.Items.Add(numss(jLp)) lvwi.SubItems.Add(strs(jLp)) lvwi.Tag = strss(jLp) Exit For End If Next jLp Next iLp End Sub |
2020年5月17日 星期日
vb.net Listview第一排數字排序 [Listview sort by first column]
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言