Sorting number numerically in List View

Using the Sort Wrapper Function (Column Click Sorting Event)

Page 1 of 1

6 Replies - 9755 Views - Last Post: 18 December 2010 - 01:50 PM Rate Topic: -----

#1 Schmit38  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 78
  • Joined: 21-December 07

Sorting number numerically in List View

Posted 18 December 2010 - 11:28 AM

In 2007 I created a program that reads weather data into a listview. When a user clicks on the column header it fires off the column click event handler which calls the Sort Wrapper function. The Sort wrapper will re-order items either in ascending or descending order.

I have never been able to get negative integers to sort properly. I have created a stripped down listview program with a few numbers in the grid for testing. (see attached program zip file).

When you run the program, click on the column header that says "Val" and you will see right away that the numbers do not sort correctly.

Thank You in advance..

Brian Schmit

OIT Graduate 2004 -- Information Tech.

Attached File(s)


This post has been edited by Schmit38: 18 December 2010 - 11:31 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Sorting number numerically in List View

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,767
  • Joined: 12-June 08

Re: Sorting number numerically in List View

Posted 18 December 2010 - 11:38 AM

I know this is C#, but the code is portable.

A person who outlines the sort pretty darn well.

http://support.microsoft.com/kb/319401
Was This Post Helpful? 0
  • +
  • -

#3 Schmit38  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 78
  • Joined: 21-December 07

Re: Sorting number numerically in List View

Posted 18 December 2010 - 12:35 PM

View Postmodi123_1, on 18 December 2010 - 10:38 AM, said:

I know this is C#, but the code is portable.

A person who outlines the sort pretty darn well.

http://support.microsoft.com/kb/319401

Thanks for the reply,

I have no idea how to port this into a vb.net program. How would I do this?
I was looking for a vb.net solution but oh well...Thanks anyway

Brian
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,767
  • Joined: 12-June 08

Re: Sorting number numerically in List View

Posted 18 December 2010 - 12:43 PM

Ah.. they are quite similar..

check this out:
http://www.harding.e...comparison.html
Was This Post Helpful? 0
  • +
  • -

#5 Schmit38  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 78
  • Joined: 21-December 07

Re: Sorting number numerically in List View

Posted 18 December 2010 - 12:59 PM

Eh, not going to try to convert that. This is why I went to the vb.net forum because I am trying to avoid C#. I realize C# is more versatile but not as user friendly. I took C++ in school and did not like it.

I am very frustrated now. I think I need to give up for a while on this.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9487
  • View blog
  • Posts: 35,767
  • Joined: 12-June 08

Re: Sorting number numerically in List View

Posted 18 December 2010 - 01:26 PM

Man.. make me do ALL the work here..

Here looks like a similar thing.. in vB.

http://www.vb-helper...ked_column.html
Was This Post Helpful? 0
  • +
  • -

#7 Schmit38  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 78
  • Joined: 21-December 07

Re: Sorting number numerically in List View

Posted 18 December 2010 - 01:50 PM

FANTASTIC!! Thats exactly what I am looking for. The original "Sort Wrapper" came from MSDN website. I never understood why it was packaged so it couldn't sort negative numbers. Anyways, you were a great help to me and I thank you VERY much.

Sorry I am so stubborn about C# material. The vb.net racks my brain hard enough already. Maybe I need to study C# because I have an mp3 player program where I am trying to use FFMPEG to get track info ahead of time before playing. Of course the only functional program code I have been able to find is a C# program...... Ugh!!

Brian Schmit
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1