Posted 18 June 2021, 6:21 am EST
Hi Said,
If you don’t want the cursor to move you can just store the value of Row and Col property of FlexGrid and then set those values back after you have moved the row.
Private Sub UpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UpToolStripMenuItem.Click
Dim r = C1FlexGrid1.Row
Dim c = C1FlexGrid1.Col
Dim row = C1FlexGrid1.Row - C1FlexGrid1.Rows.Fixed
If row = 0 Then
Return
End If
Dim data = dt.NewRow()
data.ItemArray = dt.Rows(row).ItemArray.Clone()
dt.Rows.RemoveAt(row)
dt.Rows.InsertAt(data, row - 1)
C1FlexGrid1.Row = r
C1FlexGrid1.Col = c
End Sub
Please refer to the code given above and modify it according to your requirements. If you want to keep the cursor with the row that you moved just set the Row property to the same index at which you inserted the row + the number of fixed rows in FlexGrid.
C1FlexGrid.Row = newIndex + C1FlexGrid.Rows.Fixed
Regards.
Avnish