排序数字类型 [英] Sorting Number Type

查看:70
本文介绍了排序数字类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我目前正在使用Listview控件。

控件的排序功能很有用。

Hello,

I am currently using Listview control.
The sorting feature of the control is useful.

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

@keirnus


如果设置SortKey属性= 0,它将排序使用ListItem对象的Text属性。尝试将其设置为1和ColumnHeaders之间的值 - 1使用您指定其集合索引的SubItem进行排序,然后查看会发生什么。
@keirnus
If you set the SortKey Property = 0 it will Sort using the ListItem Object''s Text property. Try setting it to a Value between 1 and Number of ColumnHeaders - 1 to Sort using the SubItem whose Collection Index you specify, then see what happens.


@ADezii


(我编辑了这个回复因为我错了...对不起)


感谢您回复ADezii。


但我发现了一些东西。 SortKey是listview中的列索引。

它以零(0)开头所以在我的例子中,因为只有1列所以

它以索引开头0.如果我有3列并希望排序第2列,我将使用索引1来b $ b。(如果我错了请纠正我)


我尝试使用数字类型对列进行排序但排序错误。

当它应该是数字时,排序就像对待它一样。
@ADezii
(I edited this reply coz I was wrong...sorry)

Thanks for the reply ADezii.

But I noticed something. The SortKey is the column index in listview.
It starts with zero(0) so in my example, since there''s only 1 column so
it starts with index 0. If I got 3 columns and want to sort the 2nd, I will
be using index 1. (please correct me if I''m wrong)

I tried sorting the column with number type and yet the sorting is wrong.
The sort is treating it like an alpha when it should be numeric.


@keirnus


一旦我有机会,我会创建一个包含ListView的DB,并查看我是否可以''排序''问题(LOL)!
@keirnus
As soon as I get a chance, I''ll create a DB with a ListView incorporated in a Form and see if I can ''Sort'' the problem (LOL)!


这篇关于排序数字类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆