Articles in this section
Category / Section

How to remove row position from the WinForms GridControl?

1 min read

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 in WinForms GridControl.

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



Conclusion

I hope you enjoyed learning on how to remove the row at a specific position from the WinForms GridControl.

You can refer to our WinForms GridControl featuretour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our our WPF GridControl example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied