Sort not sorting numbers correctly.


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I have a BO that is sorting on an int field (int in SQL Server). However the sorted results are as if the field was alpha-numeric. I.e. it sorts 1, 10, 11, 12, 2, ect. Am I missing a setting? The field is an Int32 in the BO.
Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Ah...I think the problem is that I'm using CopyData to fill a listbox and the listbox is sorting using alpha...the BO is sorting OK. I'll have to think of how to handle this.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The Sorted (of a listbox) property set to none...works great now...did I mention I was new to dotnet Wink
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
As I have mentioned before...I know that you won't have this problem again Wink and I think that you said something about ... "Yeah, pain teaches" BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Just as a side note, you can get the behavior you want through a list...or any other type of object or collection for that matter.  You can create a comparer object that compares two values any way that you like.  In fact, the framework has a sorter for a ListView called the ListViewItemSorter.  This can be used as a column sorter on a ListView.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I've read about the comparers. I'm sure I'll be using them at some point. And yeah, I won't soon forget this lesson...I've got the scares to remind me BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search