I have a windows form containing a Listview and a RichTextBox. I want to write Listview items value in RichTextBox using drag & drop. To do it, I wrote this code in Listview ItemDrag()
event handler:
listView1.DoDragDrop(((ListViewItem)e.Item).Text, DragDropEffects.Copy);
In RichTextBox DragEnter()
event handler, I wrote this code:
private void richTextBox1_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
{
string data = e.Data.GetData(DataFormats.Text).ToString();
richTextBox1.Text = data;
}
When I drag a Listview item, ItemDrag event is invoked, but when I release mouse-button in textbox nothing happens. DragEnter and DragDop event aren't Invoked. Otherwise during drag & drop operation, mouse cursor doesn't show "copy icon".
How can I fix this problem?