Articles in this section
Category / Section

How to remove a row from the WinForms GridControl?

2 mins 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 the WinForms GridControl.

//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);
}
' Hooks the event in the Form_Load to remove the rows in a Grid.
AddHandler btnRemove.Click, AddressOf btnRemove_Click

Private Sub btnRemove_Click(sender As Object, e As EventArgs)
    Dim n As Integer = Convert.ToInt16(textBox1.Text)

    'Removes the range of rows from (top, bottom).
    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 the WinForms GridControl feature tour page to know about its other groundbreaking feature representations, WinForms GridControl documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms 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 forums, Direct-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  to leave a comment
Access denied
Access denied