473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Rearrange the order of a listbox with the mouse

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

Nov 22 '05 #1
2 4231
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/winform...AndDrop2MG.asp
http://www.codeproject.com/cs/combob...ragAndDrop.asp
http://www.ondotnet.com/pub/a/dotnet...1/dragdrop.htm
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Nick Stubbs wrote:
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

Nov 22 '05 #2
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/winform...AndDrop2MG.asp
http://www.codeproject.com/cs/combob...ragAndDrop.asp
http://www.ondotnet.com/pub/a/dotnet...1/dragdrop.htm
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Nick Stubbs wrote:
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

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nick Stubbs | last post by:
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...
0
by: tommazzo | last post by:
I'm currently writing a photo album sotware in C#. I'm using a ListView component to diaplay thumbnail previews of the photos and want to give the user the possibility to rearrange the photos via a...
6
by: Dan Bass | last post by:
If you look at explorer, right clicking on a file, first selects the file, then throws up the context menu relating to that selection. With a Windows ListBox control and a simple context menu,...
0
by: AK | last post by:
Hello, Listbox mulitselect property is set to true (extended). I am trying to implement drag and drop feature for a listbox. The drag & drop is done in the mouse move event (DoDragdrop...
4
by: Alan Silver | last post by:
Hello, I have a repeater showing a list of items and I would like to be able to allow the user to change the order of the items. I have absolutely no idea how to go about this, other than having...
2
by: hazz | last post by:
is there a way to have a re-arrangeable list with an asp.net control ? I would like to have a list of database table column values in an ordered list initially loaded by their column order in the...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
2
by: laxwrestler27 | last post by:
Hello everyone, I'm creating a program for a courier service that takes info from a database to make a 2d array with the necessary info, then puts that on to an excel spreadsheet per delivery. ...
6
by: GS | last post by:
how can I set tooTip on ToolTip1 for a listbox?
4
by: simion314 | last post by:
Hi, i need to use a owner draw listbox(i am using windows forms in NET 2.0 ). I created a testlistbox ,implemented the DrawItem method and it works fine, it scrolls with the mouse wheel. After that i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.