We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Platform: WinForms |
Control: GridControl

OLE drag and drop

By default, the 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 Grid to excel, the data is moved instead of copying.


This kind of scenario can be resolved by canceling the data movement in 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 Object, ByVal e AsCancelEventArgs)
   e.Cancel = trueEnd Sub


Samples: https://www.syncfusion.com/downloads/support/directtrac/general/OLE_Drag_and_Drop_From_Grid_To_Excel1946928835.zip

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile