Xceed Grid for WinForms v4.3 Documentation
CopyPasteDragDrop Sample Application
Welcome to Xceed Grid for WinForms v4.3 > Sample applications > CopyPasteDragDrop Sample Application

Programming languages

VB.NET, C#

Overview

This application demonstrates how to copy/paste and drag/drop rows to and from Excel.

Demonstrates

  • How to handle the grid's KeyDown event. 

  • How to use the AllowDrop property of the grid as well as each DataCell in the grid to enable drag and drop related events. 

  • How to handle the MouseDown, MouseUp, MouseMove, DragOver and DragDrop events for each DataCell in the grid. 

  • How to use the grid's DoDragDrop method to begin a drag process. 

  • How to copy the content of the SelectedRows to the clipboard using an Excel compatible DataFormats object. 

  • How to add new rows to the grid whose content was retrieved from the DataObject dropped onto the grid from Excel.

How to use

To copy or drag rows to Excel, select various DataRows in the grid and press in the "Copy" button, begin to drag the rows or use the "Ctrl-C" keyboard shortcut. In Excel, you can either let go of the mouse button if you were dragging the rows or use the "Ctrl-V" keyboard shortcut. 

To paste rows or drop rows from Excel to the grid, select the rows in Excel and copy them using the "Ctrl-C" keyboard shortcut or begin dragging them to the grid. In the grid, you can paste them using either the "Paste" button, by releasing the mouse button or by using the "Ctrl-V" keyboard shortcut.

Project location & filename

C#: Xceed Samples\Xceed Grid for WinForms v#.#\CSharp\CopyPasteDragDrop\CopyPasteDragDropCS.csproj

VB.NET: Xceed Samples\Xceed Grid for WinForms v#.#\Visual Basic .NET\CopyPasteDragDrop\CopyPasteDragDropVB.vbproj