[Help] How can I drag & drop objects from one listbox to another listbox

Okay, so my form is set up with two different listboxes representing two different lists (roster & availableStudents).

I want to be able to drag one of the references to an object in the availableStudents listbox over to the roster listbox. When you drop it, I want to be able to Add() a new object using the values I dragged over to the list in roster. I would then delete the object from availableStudents.

I tried using the e.whateverThisThingWas.Data to try to get it, but it isn't working.

One work around I thought of was to create a buffer object that copies the information from the intended object when you drag the information out of the availableStudents list and then when you release over the other ListBox it adds that object in the buffer and clears the buffer.

Anyways, any thoughts? Is there something I'm just missing? Because most of the stuff the various sources I've seen only use strings.

Thanks in advance.

by r00t_kit via /r/csharp

Leave a Reply