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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Insert or Delete rows

Thread ID:





978 Sep 10,2002 04:47 AM UTC Nov 19,2002 07:50 AM UTC WinForms 3
Tags: GridControl
Harvey Green
Asked On September 10, 2002 04:47 AM UTC

How can I insert a row (and have all rows below it shift down automatically) and also delete a row and have all rows below it shift up? Thanks

Clay Burch [Syncfusion]
Replied On September 10, 2002 05:22 AM UTC

To remove rows in a GridControl, use the GridControl.Rows.RemoveRange method. To insert rows into a GridControl, use the GridControl.Rows.InsertRange method. For a GridDataBoundGrid, the methods are GridDataBoundGrid.Binder.RemoveRecords and GridDataBoundGrid.Binder.AddNew.

Thomas Eyde
Replied On November 19, 2002 07:27 AM UTC

Thank you. But I guess I have to be more precise. How do I invoke the deletion from the GUI? I like to select one or more rows, then press the delete button. But I can't find the proper event.

Administrator [Syncfusion]
Replied On November 19, 2002 07:50 AM UTC

Try handling the CurrentCellKeyDown event.
Private Sub GridControl1_CurrentCellKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles GridControl1.CurrentCellKeyDown
        If e.KeyCode = Keys.Delete Then
            Dim range As GridRangeInfo = Me.GridControl1.Selections.Ranges.ActiveRange
            If range.IsRows Then
                Me.GridControl1.Rows.RemoveRange(range.Top, range.Bottom)
                e.Handled = True
            End If
        End If
    End Sub


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon