ComponentOne FlexGrid for WinForms
DragRowColEventArgs Class
Members  Example 

C1.Win.C1FlexGrid Namespace : DragRowColEventArgs Class
Provides data for the C1FlexGridBase.BeforeDragColumn, C1FlexGridBase.BeforeDragRow, C1FlexGridBase.AfterDragColumn, and C1FlexGridBase.AfterDragRow events.
Syntax
'Declaration
 
Public Class DragRowColEventArgs 
   Inherits System.EventArgs
public class DragRowColEventArgs : System.EventArgs 
Remarks
Example
If the grid is unbound, the Drag-Drop of Rows works perfectly well. In the case where the grid is bound to a DataTable, an ArgumentException is thrown while Dragging and Dropping rows. This occurs because of the DataSource. When a row is dragged, the grid first removes the row from its original position and then re-inserts it into a new position. In bound mode, this requires calling methods on data source object. The code example below depicts how you can perform the drag drop of rows in bound mode using the BeforeDragRow event.
private void Form1_Load(object sender, EventArgs e)
{
            _flex = new C1FlexGrid();
            _flex.Dock = DockStyle.Fill;
            this.Controls.Add(_flex);

            OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb");
            _ordersTable = new DataTable();
            new OleDbDataAdapter("Select * from Orders", con).Fill(_ordersTable);

            //Set AllowDragging property to Rows
            _flex.AllowDragging = AllowDraggingEnum.Rows;
            _flex.BeforeDragRow += _flex_BeforeDragRow;
            _flex.DataSource = _ordersTable;
}

private void _flex_BeforeDragRow(object sender, DragRowColEventArgs e)
{
            //Implementation of dragging of rows in a bound flexgrid
            DataRow drDragged = _ordersTable.Rows[e.Row - 1];
            object[] arr1 = drDragged.ItemArray;
            //Temporary Row to store data of row being dragged
            DataRow dr1 = _ordersTable.NewRow();
            dr1.ItemArray = arr1;

            _ordersTable.Rows.Remove(drDragged);
            //Insert row at the new position
            _ordersTable.Rows.InsertAt(dr1, e.Position - 1);
            _flex.DataSource = _ordersTable;
            e.Cancel = true;
}
Inheritance Hierarchy

System.Object
   System.EventArgs
      C1.Win.C1FlexGrid.DragRowColEventArgs

See Also

Reference

DragRowColEventArgs Members
C1.Win.C1FlexGrid Namespace