# Filling Cells with Drag and Drop

Learn how to implement drag-and-drop functionality within your spreadsheet application using Spread.NET's FpSpread class and AllowDragDrop property.

## Content

You can allow the end user to drag-and-drop data from one range of cells to another. You can specify whether the user can select a cell or range of cells and drag and drop them to a new location in the same spreadsheet within the same Spread component. When the mouse button is released and the range of cells is dropped, the [DragDropBlock](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.DragDropBlock.html) event occurs.
For more information, refer to the [AllowDragDrop](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowDragDrop.html) property in the [FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) class. For more information on event arguments, refer to [DragDropBlock](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.DragDropBlock.html) event, [DragDropBlockEventArgs](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.DragDropBlockEventArgs.html), and [DragDropBlockCompletedEventArgs](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.DragDropBlockCompletedEventArgs.html).

## Using the Properties Window

1. At design time, in the **Properties** window, select the Spread component.
2. Select (in the **Behavior** category) the **AllowDragDrop** property.
3. Select **True** from the drop-down list to allow drag-and-drop feature, or select **False** to prohibit it.

## Using a Shortcut

Allow the drag-and-drop feature by setting the [AllowDragDrop](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowDragDrop.html) property for the [FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) component.
**Example**
This example code sets the component to allow the drag-drop feature.

```csharp
fpSpread1.AllowDragDrop = true;
```

```vbnet
fpSpread1.AllowDragDrop = True
```

## Using Code

Allow the drag-and-drop feature by setting the [AllowDragDrop](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.AllowDragDrop.html) property of the [FpSpread](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.FpSpread.html) component.
**Example**
This example code sets the child sheet to allow the drag-drop feature.

```csharp
FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook();
sv.AllowDragDrop = true;
```

```vbnet
Dim sv As FarPoint.Win.Spread.SpreadView = fpSpread1.GetRootWorkbook
sv.AllowDragDrop = True
```

## Using the Spread Designer

1. From the **Settings** menu, select **General** (**Spread Settings** section).
2. In the **General** tab, select the settings for the drag and drop properties as needed.
3. Click **OK**.
4. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

or

1. Select the Spread component (or select **Spread** from the pull-down menu).
2. In the property list for the component (in the **Behavior** category), select the **AllowDragDrop** property.
3. Click the drop-down arrow to display the choices and select **True**.
4. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

## See Also

[Filling Cells with Drag and Fill](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cell-dragops/spwin-cell-dragfill)
[Filling Cells with Drag and Move](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cell-dragops/spwin-cell-dragmove)