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

How to Insert or Delete rows

Thread ID:

Created:

Updated:

Platform:

Replies:

978 Sep 10,2002 12:47 AM Nov 19,2002 02:50 AM Windows Forms 3
loading
Tags: GridControl
Harvey Green
Asked On September 10, 2002 12:47 AM

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 01:22 AM

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 02:27 AM

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 02:50 AM

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

CONFIRMATION

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.

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.

;