If you have a look at the attached project you can see that there are two listviews in it, and two buttons.
If you select any item in any listview and click on the proper button, you'll get a message of which is the item(s) which is/are selected. This is working Ok.
Now, order the listviews with the column you like most and select any item. When you click on the proper button... you'll see that the left button would state a wrong item as if it was selected. Try several of them and you'll see what I mean.
How can this be fixed? Thanks in advanced.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
That's right. The ListView i'm actually using (in the real project) accepts multiple selection. However... hang on. It seems I've already corrected. Let me make a couple of more tests and keep you posted.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
This modifications works well with strings only. With numbers and dates (the one I tested) only "works" when it is ascending order.
Can anyone fix this, please?
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
I haven't the foggiest on the SendMessage but I did find this while reading up on LVM_SORTITEMS
The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent
NOTE: Using this approach, you will sort the data in the control but not the ListItems collection. Therefore, if you must read the data from the list in sorted order, it is necessary to step through the actual list rather than the ListItems collection.
NOTE: Using this approach, you will sort the data in the control but not the ListItems collection. Therefore, if you must read the data from the list in sorted order, it is necessary to step through the actual list rather than the ListItems collection.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
Yup... your selected button displays the numerical part of the collection key. Try it with Msgbox Item.Key in ItemClick() event and compare it with the result of your selcted button
Originally posted by leinad31 Yup... your selected button displays the numerical part of the collection key. Try it with Msgbox Item.Key in ItemClick() event and compare it with the result of your selcted button
Ok, and how would you step through it?
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
i could never get it to work right... my only thought is there has to be some way to obtain it via API... because i dont see any way to get it via the exposed properties of the listview
Originally posted by kleinma sad thing is I dont think they fixed this in the .NET control either
You've tried this in .NET and it still has issues?
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
well i mean as far as sorting by date or by numeric.. i would have thought by now it would be built into the control to detect the data type and sort correctly... but sadly the .net control still only sorts on strings
i mean isnt the listview the same damn control used by windows explorer??? that sorts by number and date
Originally posted by kleinma ... i mean isnt the listview the same damn control used by windows explorer??? that sorts by number and date
Yes, I know what you mean. Probably they use this same code... but they know how to scroll through the actual list instead of the ListItems collections.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
Originally posted by Mc Brain Yes, I know what you mean. Probably they use this same code... but they know how to scroll through the actual list instead of the ListItems collections.
yeah its kind of bullshiznitz that they tell you in the KB article that you NEED to enumerate through the actual list and not the listitems collection, but dont tell you how to do it
I don't even know how to access any of the elements of the list without using the listitems collection property... but then again i guess if I did know we would already have an answer
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
The problem is that the SelectedItem property is not useful for me. In my project the MultiSelect property is set to true, on purpose. This is to let the user to select several items and, for example, delete them altogether.
This is why I need this code to work correctly... otherwise, the items that the LV would delete will not be the ones the user's selected but the ones the LV thinks they're selected.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
you can multiselect and then sort, and it will still be the right listitems...
Oh, sorry. I didn't try it because I thought the solution was to use the SelectedItem property. Seems to be working Ok.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
May I add myself to the 'notes' with the "improves" I've just made to the code and upload it??
BTW, it's a bit slow if you have too many items on the LV.
Emiliano F. Martín
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
sure, I have no intentions to copyright it or anything like that... otherwise i wouldn't upload it to the forum
you can modify anything.. just include me at least in the comments.
it can be slow with lots of items, because it has to format each item so that it can do an accurate text sort on it... then switch it back to its original form... unfortunatly, this is the only possible way I see to do this.
If a post has helped you then pleaseRate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.