user153923
user153923

Reputation:

Windows Forms Drag and Drop Functionality

I appear to have all of the things necessary for Drag-n-Drop to be working, yet my code is not called when I attempt to drag something from one control to another.

ListViewsForm

Whenever I run the project, everything loads up fine, but any attempt to drag an item from the LEFT side to the RIGHT side does nothing. None of my break points are hit. Nothing happens.

What have I left out?

Upvotes: 1

Views: 1184

Answers (1)

LarsTech
LarsTech

Reputation: 81610

You are missing a handy event and the method that starts the dragging operation:

listView1.ItemDrag += listView1_ItemDrag;

void listView1_ItemDrag(object sender, ItemDragEventArgs e) {
  DoDragDrop(e.Item, DragDropEffects.Copy);
}

Upvotes: 1

Related Questions