Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Sorting Listview control on date

Sorting Listview control on date

Sorting Listview control on date

I am using Listview control combined with a treeview control on my main form. Ive implemented code to sort the listview.
Problem is The listview control is not sorting the date column correctly. It sorts the date characterwise i.e 03/06/2000, 03/07/2000, 04/06/2000 etc..

Please help

Thanks in advance.

RE: Sorting Listview control on date

add another column that is julian date, and sort by that, but don't display it in the list.  Or you could change your format to YYYY/MM/DD.  Is the data type for your dates strings or dates?


RE: Sorting Listview control on date

Hi Blindpete

Sorry for not responding. was away

the data type for dates is date in the format dd/mm/yyyy which is what we use in India. I need to display document no. date and amount from my date file in my listview with sorting enabled on all columns. I dont seem to get the date column to sort properly as I mentioned earlier. how can I add a column to the listview and not display it?

Thanks in advance

RE: Sorting Listview control on date

You can add a column to a list (or combobox) by including it in whatever builds the RowSource for the list (a SELECT statement, for example), and not display it by ensuring the BoundColumn property is set to 1, and setting the ColumnWidths property to something wide enough so the second one doesn't show (i.e. 200,1 sets the first column's width to 200 pixels and the second to 1 pixel).  These values assume your form's ScaleMode is Pixels.

Robert Bradley

FoxDev - Visual FoxPro Development

RE: Sorting Listview control on date

Thanks everyone for your responses.

I think I have not clarified that I am using The Listview ActiveX control and not a native listbox control here. I have implemented code to sort the listview in the columnclick event. The problem of date sorting still remains as I mentioned above.

Thanks again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close