|
-
Apr 5th, 2000, 06:28 PM
#1
Thread Starter
Lively Member
Hi,
I have a column in my listview that I want have sorted. At present I have the listview sorted and in descending order. The field that I have loaded from the database is a DATE field. My problem is : The listview sorts the data but by the first number of the date field. Is there a way to make it sort the whole date and have it sort in descending order and not just the first 2 numbers of the date. Any ideas would be greatly appreciated and Thanks in advance.
Mike
-
Apr 5th, 2000, 08:02 PM
#2
Fanatic Member
Try this:
Convert Dates to YYYYMMDD format
ListView.Sorted = True
ListView.Sorted = False
Convert Dates back to usual format
I store the type of column in the Listview column Tag at population, so that I know what type the column is when I sort.
By the way, the General VB forum is the best place to get VB questions answered.
-
Apr 6th, 2000, 08:26 PM
#3
Thread Starter
Lively Member
Hi,
I am not sure what you mean to convert the date to YYYYMMDD. I mean where do you mean to change it. do you mean in the database or in the listview as it loads or where? Not sure.
Also not usre what you mean by the .tag property either, well how to use it anyway.
Mike
-
Apr 6th, 2000, 10:29 PM
#4
Fanatic Member
The code goes in the ColumnClick event of the Listview.
You know which column you're in by the Index property passed into the event.
This is code to convert the 1st column to the sort format:
For i = 1 To ListView.ListItems.Count
ListView.ListItems(i).Text = Format(ListView.ListItem(i).Text, "yyyymmdd")
Next i
You'll have to write a function to convert back to the display format following the sort.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|