$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
DataGridView for Windows Forms
Create data gird view in C# with modern user interface for your Windows Forms applications
Home > WinForms UI Controls > User Manual > Insert Rows in C#

Add and Insert New Rows in C# DataGridView

The Kettic DataGridView Component has the ability to add and insert a single row as well as a group rows while integrating the GridView component into Windows Forms applications. This feature allows end users easily add and insert rows into current grid. A row in the grid stands for a record that is from the Data Source and the Kettic GridView Control contains a row collection which offers the methods to add or insert items.

Add Grid Rows in C#

To add and insert rows into the Kettic GridView, we need to use the Row collection to accomplish that. The following is a sample that shows how to add an empty row and enter a value to the existing columns by using the KetticGridView.AddNewRows() method. The existing columns include grid view text box column, decimal column, datetime column and check box column.

C# Code for Adding New Rows to GridView


Add Value to GridView Columns

When we add new rows to the existing columns, we can also specify values to the column by using the method, KetticGridView.AddRows.(). The following is an example that shows how to specify values to the new added row for each column in C#.

ketticGridView.AddRows("New Row", 10.5, DateTime.Current, true);
The Kettic GridView also allows users of the control to add new rows by generating an instance of GridViewDataRowInformation and then adding the instance to the DataGridView Rows collection.

GridViewDataRowInformation rowInformation = new GridViewDataRowInformation(this.ketticGridView.MasterView);
rowInformation.Cells[0].Value = "GridViewDataRowInformation";
rowInformation.Cells[1].Value = 10.5;
rowInformation.Cells[2].Value = DateTime.Now.AddDays(5);
rowInformation.Cells[3].Value = true;

Insert Rows to C# GridView

The Kettic GridView allows users of the control to insert rows at a pointed location, which can be accomplished through the Insert method of the Kettic GridView Rows collection. The following is an example that shows how to insert rows to a specified place in C# Windows Forms template project.

GridViewDataRowInformation dataRowInformation = new GridViewDataRowInformation(this.ketticGridView.MasterView);
dataRowInformation.Cells[0].Value = "Insert Row";
dataRowInformation.Cells[1].Value = 1022.68;
dataRowInformation.Cells[2].Value = DateTime.Now.AddDays(7);
ketticGridView.InsertRows (2, dataRowInformation);
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