Click to See Complete Forum and Search --> : Drag & Drop on DataGrid Not Working


AMON
April 4th, 2003, 04:44 PM
I have AllowDragDrop set to TRUE on DataGrid1 and DataGrid2.

Here is my code..

private void dataGrid1_DragLeave(object sender, System.EventArgs e)
{
string strText = "Testing";
dataGrid1.DoDragDrop(strText, DragDropEffects.Copy) ;
}

private void dataGrid2_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
string strText = e.Data.GetData(DataFormats.Text).ToString();
MessageBox.Show(strText);
}


I'm trying to do a grad test to pass the word "Testing". When I drag an item from datagrid1 to datagrid2, nothing happens. Any idea what is going on?

Thank you!
- Adrian

pareshgh
April 7th, 2003, 11:33 AM
AMON,
when you drag text does it comes in
dataGrid2_DragDrop method atleast.


-Paresh

AMON
April 7th, 2003, 04:33 PM
Hi Pareshgh,

No, not even the dataGrid2_DragDrop method. There are no visible signs on dataGrid1 or dataGrid2 that drag and drop is working.

I also tried changing the ReadOnly attribute on the dataGrids, but the same happens.

Any suggestions?

Thanks you,
- Adrian

pareshgh
April 7th, 2003, 04:42 PM
Hi,
I have attached the source code project for Datagrid Text drag and drop.

you can have a look and check it out.

hope this helps

Paresh