)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to remove the row at a specific position from the WinForms GridControl?

Platform: WinForms |
Control: GridControl |
Published Date: May 5, 2015 |
Last Revised Date: December 20, 2019
Tags: row, position

Remove the specific row in grid

To remove the row at a specific position, you need to use the Rows.RemoveRange() method. It has two arguments from and to that are used to remove the range of rows.

C#

//Hooks the event in the Form_Load to remove the rows in a Grid.
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
private void btnRemove_Click(object sender, EventArgs e)
{         
    int n= Convert.ToInt16(textBox1.Text);
    //Removes the range of rows form (top, bottom).
    this.gridControl1.Rows.RemoveRange(n,n);
}

VB

'Hooks the event in the Form_Load to remove the rows in a Grid.
Private Me.btnRemove.Click += New System.EventHandler(AddressOf Me.btnRemove_Click)
Private Sub btnRemove_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim n As Integer= Convert.ToInt16(textBox1.Text)
    'Removes the range of rows form (top, bottom).
    Me.gridControl1.Rows.RemoveRange(n,n)
End Sub

The following screenshot illustrates the removal of the rows at a given position.

Remove the rows at specific location in grid

Samples:

C#: RemoveRowAtSpecificPosition

VB: RemoveRowAtSpecificPosition

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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