Rearrange the order of a listbox with the mouse

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me how to code the listbox so I can move an item up and down
the listbox with the mouse. For example, the play list in Winamp 5 can be
sorted by you selecting a song and moving it up or down the play list by
selecting it with the mouse and dragging it where you want.
The list box gets the contents from a .txt file. (if you need more info
please let me know)

Many Thanks
Nick
 
Well basically you need to drag and drop the listbox items. What you
need to do is that when the item is dragged and dropped you need to
remove the item from the listbox using Remove() method and then insert
it at the new location using the Insert() method of the listbox.

For more info on how to drag and drop see the following articles
http://www.c-sharpcorner.com/winforms/DragAndDrop2MG.asp
http://www.codeproject.com/cs/combobox/LarryDragAndDrop.asp
http://www.ondotnet.com/pub/a/dotnet/2002/11/11/dragdrop.htm


Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
 

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

Back
Top