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 DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlGridView - Get Started in C#GridView - PropertiesGridView - ColumnGridView - RowGridView - CellsGridView - EditorsGridView - Context MenuGridView - Populating with DataGridView - Hierarchical GridGridView - SelectionGridView - ScrollingGridView - SortingGridView - GroupingSet ProgrammaticallyUsing ExpressionsGroups CollectionFormat Group Header RowGridView - FilteringFiltering RowSet Filters ProgrammaticalllyExcel Like FilteringGridView - Expression EditorDisplayCustomizeLocalizationInsert/ Update/ Delete RecordsData EditInsert / Update / EditGridView - View DefinitionGridView - Exporting DataStyling and AppearanceGridView - LocalizationSave and Load LayoutGridView - Print SupportWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |