We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Moving rows

Hello, I''m using a GridControl class in my application and I want to be able to move a range of rows around. For example, if a user deletes a row, I want to be able to move all the rows below it up one row. Each row in my grid contains a combo box, push button and/or covered cells. I''ve tried using the me.GridControl.Rows.MoveRange method to accomplish the shifting of rows, but it did not work. Are there any methods (i.e. refresh) that I need to call to see my changes after executing the MoveRange method? Does the MoveRange method work on rows that contain combo boxes, push buttons, etc? I''m using Essential Suite 1.6.1.8, Windows XP Professional, and Visual Studio Enterprise Architect 2003. Thanks, Andrew

1 Reply

AD Administrator Syncfusion Team December 1, 2003 03:57 AM

When I user clicks on a row header in a GridControl, you can delete the row using the KeyDown event.
Private Sub gridControl1_KeyDown(sender As Object, e As KeyEventArgs)
   If e.KeyCode = Keys.Delete Then
      Dim rangeList As GridRangeInfoList = gridControl1.Selections.GetSelectedRows(True, False)
      Dim range As GridRangeInfo = rangeList.ActiveRange
      If Not range.IsEmpty Then
         Me.gridControl1.Rows.RemoveRange(range.Top, range.Bottom)
         e.Handled = True
      End If
   End If
End Sub ''gridControl1_KeyDown
So, you do not really need to call Rows.MoveRange. But if you do use MoveRange from something, it should work OK for any cell type including comboboxes and push buttons provided you are not using the GridControl in a virtual manner. If you are using it in a virtual manner, you would need code in your external datasource that handles deleting or moving rows.

Loader.
Live Chat Icon For mobile
Up arrow icon