Articles in this section

How to restrict the moving of data while OLE drag and drop instead of copying from grid to excel in WinForms GridContro?

OLE drag and drop


By default, the WinForms GridControl supports drag and drop of the data within the Grid or other Grids by copying the data or moving the data. But when drag and drop is performed from the Grid to Excel, the data is moved instead of copied.

 

Solution

This kind of scenario can be resolved by canceling the data movement in the QueryDragDropMoveClearCells event.

//Triggering the QueryDragDropMoveClearCells event        
this.gridControl1.Model.QueryDragDropMoveClearCells += new CancelEventHandler(Model_QueryDragDropMoveClearCells);

//Handling the event
void Model_QueryDragDropMoveClearCells(object sender, CancelEventArgs e)
{
   e.Cancel = true;
}
'Triggering the QueryDragDropMoveClearCells event
AddHandler Me.gridControl1.Model.QueryDragDropMoveClearCells, AddressOf Me.Model_QueryDragDropMoveClearCells

'Handling the event
Private Sub Model_QueryDragDropMoveClearCells(ByVal sender As ObjectByVal e AsCancelEventArgs)
   e.Cancel = trueEnd Sub
Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied