bogdem
asked on
VB.NET 2005 Drag and Drop item from List onto PictureBox
Hello, Experts!
Let say I have few PictureBoxes, and one ListBox, I want to be able drag and drop one element from ListBox onto PictureBox, on Drop event I want to see the MsgBox
With information what Item I just dropped and on what control I did it
Any help greatly appreciated.
Let say I have few PictureBoxes, and one ListBox, I want to be able drag and drop one element from ListBox onto PictureBox, on Drop event I want to see the MsgBox
With information what Item I just dropped and on what control I did it
Any help greatly appreciated.
ASKER
Sorry, couldn’t make this code work.
What version of .net are you using?? 2003 or 2005?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot.
Public Sub PictureBox_DragDrop(sender
End Sub
After creating the method I would add handlers for all of the picture boxes to be handled by this method. Maybe do this in the Form_Load event.Ex.
AddHandler PictureBox1.DragDrop, AddressOf PictureBox_DragDrop
AddHandler PictureBox2.DragDrop, AddressOf PictureBox_DragDrop
Don't forget to set each picture box's AllowDrop property to True
On MouseDown of the Listbox you want to capture the information you want to pass to your picturebox. This could be a reference to the listbox object or some other custom object you create to capture the information you want to send. an example of passing the listbox would be something like this coded in the ListBox_mouseDown Event.
listbox1.doDragDrop(listbo
Then in the PictureBox_DragDrop method first listed in this example you could add the following code:
MessageBox.Show(DirectCast
I hope this helps get you started on working with this. This is just a generic example of how to complete the drag drop and get general information. You can get many other fields from the objects passed.
jjardine