I am currently attempting to modify your code to allow me to drag values
within a listbox to modify the sort order. I am using a sort value for
each
record in a table. I am currently able to get the value selected but have
not
yet been able to determine the value where the drop occurs. Still working
on
it.
I haven't seen Dougs code, but I've previously made som well functioning
drag-drop functionality with the following approach.
On the form I keep a hidden control (could the a small textbox, button etc)
that would become visible on the MouseDown Event over for example a listbox.
As I'm moving the mouse, I'm using th xy-coordinates of the mouse the
constantly change the position of the previously hidden and now visible
dummy-control.
This appears as one is "dragging" the control.
To detect the drop: I had looked at the height of the listbox in pixels, the
top and left positions of the listbox on the form and the height of a single
line in the listbox. With these numbers and som simple math, it's possible
to run a function on the MouseUp event that calculates "where you are" in
the listbox, when the button is released.
You can then update the tables/sortorders accordlingly and update the
listbox.
It took a while, but works good.
Jesper Fjølner