- Online Barcode Generator
- How To
- Buy Now
Insert, Update, and Delete Rows in C#.NET
The Kettic DataGridView Control for Windows Forms provides powerful data editing functionalities. GridView users can easily restrict user interaction and data modification as necessary through the properties. Furthermore, it is easy to perform cell editing or data entry for end users at any time they need to manipulate the data. It also offers a very nice interface for end users to edit or insert data via an editor based on data type.
How to Insert Rows in Grid using C#
Kettic GridView provides two different ways to add new rows into grid. One is to add new grid rows into the data source that has been bound to the GridView project. The other is to programmatically insert new rows to the Rows collection of GridView C# class. The Add method will be used to insert rows to grid.
C# code for inserting rows to the rows collection by using the GridView control
How to Update Rows to Grid in C#
When the users need update a row in grid, they should use the GridViewCellInformation.Value property to achieve this. It is able to access to this property via the Cells collection of every row. Before we assign an updated value to the GridViewCellInformation.Value, we must fire the GridView.Validate event, which might be disabled to prevent updating the value in a cell in grid.
C# code for setting a value to a cell in grid to update the row
How to Delete Rows from Grid using C#
When the users need remove a row from the rows collection of GridView in their application, they should call the GridViewRowCollection.Delete(GridViewRowInformation value) or GridViewRowCollection.DeleteAt(rowIndex) in their C# project. The following is the sample.
C# code for deleting a row from the rows collection of GridView in .NET Windows Forms application
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls