Steps:
1. Place a Lisbox on a Form. Load it with list of some
kind from a database, perhaps.
2. Place a TextBox on the Form
3. Create a handler for ListBox.SelectedIndexChanged. In
the handler, set the TextBox.Text to the selected item in
the Listbox.
4. Run the program. Click different items in the
ListBox. You should see the text in the TextBox change -
as expected.
NOW
Add another method, this one a Handler for
ListBox.MouseDown as suggested in the Drag-Drop write up
in the MSDN documentation. Here you get the X, Y of
mouse-click, convert the numbers to an index of the item
clicked, and then call ListBox.DoDragDrop()
It is not necessary to create a receptacle for the drop.
The call to ListBox.DoDragDrop we created above
effectively blocks the ListBox.SelectedIndexChanged event.
Run the program again. Click on the ListBox items, there
will be no change in the listbox. In fact the
SelectedIndexChanged event is not even raised.
It is not the MouseDown handler but the call to
DoDragDrop that is the culprit, because if you comment
that one line while leaving the rest of the MouseDown
handler routine intact, the normal behavior returns.
I tried to find a workaround by raising my own DragDrop
event in the ListBox.OnMouseDown, thinking that perhaps
calling MyBase.OnMouseDown before raising the DragDrop
event might help - but it didn't.
Javed
George Shepherd's Windows Forms FAQ contains an entry entitled:
How do I implement Drag and Drop support between ListBoxes?
Check it out at:
http://www.syncfusion.com/faq/winforms/search/610.asp
=================================================
Clay Burch, Syncfusion, Inc.
Download a Free Trial of Essential Suite
visit http://www.syncfusion.com for .NET Essentials
"Javed" <ja...@tessdata.com> wrote in message
news:a66701c24fd2$159555b0$3bef2ecf@TKMSFTNGXA10...