ListView problems (2 actually!)

C

Campbell

Hi,

I have designed a drag & drop method of sorting a listview which also
allows you to move the listbox items from one listview to another. This
all works fine apart from two things.

Take the example of the list:

Apple
Orange
Pear
Lemon

1) At the end of my drag I want to select (highlight) the newly moved
item. If I click my mouse on Orange and drag it down to Lemon, it
inserts it before Lemon which is the behaviour I want. I can
programmatically select Orange in its new position, but once my program
leaves the MouseDown event (where I call DoDragDrop) the selected item
reverts to Pear (the item at the Index I was at when I started the
Drag). Because it's the Listview that seems to be remembering the
position and it is changing after the MouseDown event (and MouseUp)
there seems to be no way I can set my selection.

2) Because I want user ordering I have Sorting = None, then have a
facility to sort the list on an ad-hoc basis. My procedure for this is:

Private Sub Sort()
lvwList.Sorting = SortOrder.Ascending
lvwList.Sorting = SortOrder.None
End Sub

This works perfectly, but for some reason as soon as I've done it the
..Focused property stops working on my Listview. In fact, all the
listviews in my application.

Any ideas?

Thanks,
Campbell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top