# User Interaction

FlexGrid for WinForms lets you give power to the end user by allowing to edit, drag, freeze or resize the rows. Know more about user interaction operations here.

## Content

This topic discusses how you can let end-users interact with the FlexGrid rows.

![User interaction](https://cdn.mescius.io/document-site-files/images/2f10b028-0ae8-4c29-a102-4d67578c339b/images/row-user-interaction.gif)

## Allow Adding

By default, FlexGrid does not allow end-user to add new row to the grid. To provide an option to add rows at runtime, you can set **AllowAddNew** property of the <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="C1FlexGrid" data-popup-theme="ui-tooltip-green qtip-green">C1FlexGrid</span> class to **true**. FlexGrid also provides a design-time option **Enable Adding Rows** in **C1FlexGrid Tasks** menu to allow adding new row by the end-user. For more information on task menus, see [Tasks Menus](/componentone/docs/win/online-flexgrid/quick-start/design-time-support/tasks-menus). Moreover, you can also set watermark text to be displayed in the new row template through **NewRowWatermark** property.

Use the code below to allow users to add rows in WinForms FlexGrid at run-time.

```csharp
// Allow user to add rows
 c1FlexGrid1.AllowAddNew = true;
// Set watermark in the template new row
 c1FlexGrid1.NewRowWatermark = "Add new row";
```

```vbnet
' Allow user to add rows
 c1FlexGrid1.AllowAddNew = True
' Set watermark in the template new row
 c1FlexGrid1.NewRowWatermark = "Add new row"      
```

## Allow Deleting

FlexGrid, by default, does not allow end-user to delete rows from the grid. However, if your application requires, you can let the end-user delete the selected rows through **Delete** key by setting **AllowDelete** property to **true**. You can also enable row deletion by checking ON the **Enable Deleting Rows** checkbox on the **C1FlexGrid Tasks** menu.

Following code shows how to allow users to delete rows from WinForms FlexGrid at run-time.

```csharp
// Allow user to delete rows
c1FlexGrid1.AllowDelete = true;
```

```vbnet
' Allow user to delete rows
c1FlexGrid1.AllowDelete = True          
```

## Allow Dragging

FlexGrid, by default, does not allow user to rearrange rows by dragging. However, you can change this behavior in unbound grid by using the <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="FlexGrid.AllowDragging" data-popup-theme="ui-tooltip-green qtip-green">FlexGrid.AllowDragging</span> property and <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="Row.AllowDragging" data-popup-theme="ui-tooltip-green qtip-green">Row.AllowDragging</span> property. To enable dragging of grid rows, you can set the **FlexGrid.AllowDragging** property to either **Rows** or **Both**. This property accepts the values from <span data-popup-content="This enumeration is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022C1.Win.FlexGrid.5~C1.Win.FlexGrid.AllowDraggingEnum.html\u0022\u003e.NET\u003c/a\u003e." data-popup-title="AllowDraggingEnum" data-popup-theme="ui-tooltip-green qtip-green">AllowDraggingEnum</span>. You can also disable dragging of a particular row by setting the **Row.AllowDragging** property to **false**.

Let users drag the rows in an unbound WinForms FlexGrid at run-time by using the code below.

```csharp
// Allow dragging of all rows across the grid   
 c1FlexGrid1.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.Rows;
// Disable dragging of a particular row
 c1FlexGrid1.Rows[3].AllowDragging = false;  
```

```vbnet
' Allow dragging of all rows across the grid      
 c1FlexGrid1.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.Rows
' Disable dragging of a particular row
 c1FlexGrid1.Rows(3).AllowDragging = False       
```

## Allow Freezing

To allow end user to freeze the rows at runtime, you can use <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="AllowFreezing" data-popup-theme="ui-tooltip-green qtip-green">AllowFreezing</span> property of the <span data-popup-content="This class is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="C1FlexGrid" data-popup-theme="ui-tooltip-green qtip-green">C1FlexGrid</span> class which accepts values from <span data-popup-content="This enumeration is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="AllowFreezingEnum" data-popup-theme="ui-tooltip-green qtip-green">AllowFreezingEnum</span>. When this property is set to **Rows** or **Both**, a lock sign appears when mouse is hovered over the edge of header row. End-user can click and drag the lock sign to freeze the rows.

Use the code below to allow your users to freeze the WinForms FlexGrid rows at run-time.

```csharp
// Allow freezing of rows at runtime
c1FlexGrid1.AllowFreezing = C1.Win.C1FlexGrid.AllowFreezingEnum.Rows;
```

```vbnet
' Allow freezing of rows at runtime
c1FlexGrid1.AllowFreezing = C1.Win.C1FlexGrid.AllowFreezingEnum.Rows      
```

## Allow Resizing

By default, FlexGrid does not give option to resize the rows. To change this behavior, you can use <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="AllowResizing" data-popup-theme="ui-tooltip-green qtip-green">AllowResizing</span> property of the **C1FlexGrid** class. This property accepts values from the <span data-popup-content="This enumeration is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="AllowResizingEnum" data-popup-theme="ui-tooltip-green qtip-green">AllowResizingEnum</span> enumeration which enables end-user to change size of columns, rows or both. The enumeration also gives you options to uniformly resize the rows, columns or both, that is, if you resize one of the columns or rows, the grid automatically resizes rest of the columns or rows as well. FlexGrid also provides <span data-popup-content="This property is available in both \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET Framework\u003c/a\u003e and \u003ca href=\u0022/componentone/docs/win/online-flexgrid/\u0022\u003e.NET\u003c/a\u003e." data-popup-title="Row.AllowResizing" data-popup-theme="ui-tooltip-green qtip-green">Row.AllowResizing</span> property which is Boolean type and lets you enable or disable resizing of a particular row.

Following code shows how to allow users to resize the WinForms FlexGrid rows at run-time.

```csharp
// Allow user to resize rows
   c1FlexGrid1.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Rows;
// Stop user from resizing second row
   c1FlexGrid1.Rows[2].AllowResizing = false;
```

```vbnet
' Allow user to resize rows
    c1FlexGrid1.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Rows
' Stop user from resizing second row
    c1FlexGrid1.Rows(2).AllowResizing = False    
```