Telerik UI for WinForms

Insert rows

Two general approaches in adding new rows exist. The first one is to add rows directly into the data source assigned to the grid (see RadGridView data binding). The second approach is to use the Add method of the Rows collection of RadGridView.

Copy[C#] Adding rows to the rows collection
object[] row1 = new object[3];
row1[0] = 1;
row1[1] = "some text";
row1[2] = true;
// add first row
radGridView1.Rows.Add(row1);
// add second row
radGridView1.Rows.Add(2, "another text", false);
Copy[VB.NET] Adding rows to the rows collection
Dim row1 As Object() = New Object(3) {}
row1(0) = 1
row1(1) = "some text"
row1(2) = True
' add first row
RadGridView1.Rows.Add(row1)
' add second row
RadGridView1.Rows.Add(2, "another text", False)

Update rows

The data in a row can be updated by assigning the new value to the GridViewCellInfo.Value property. The access to the GridViewCellInfos is through the Cells collection of each row (type GridViewRowInfo).

Before the value is set RadGridView.Validating event is fired. This event could be canceled to prevent updating the value in the cell. After the value update RadGridView.Validated event is fired.

Copy[C#] Assigning value to a cell
radGridView1.Rows[0].Cells[0].Value = 4.3;
radGridView1.Rows[1].Cells["Column1"].Value = 114f;
Copy[VB.NET] Assigning value to a cell
RadGridView1.Rows(0).Cells(0).Value = 4.3
RadGridView1.Rows(1).Cells("Column1").Value = 114.0F

Delete rows

To delete row call GridViewRowCollection.Remove(GridViewRowInfo value) or GridViewRowCollection.RemoveAt(rowIndex).

Copy[C#] Removing a row from the rows collection
this.radGridView1.Rows.RemoveAt(1);
this.radGridView1.Rows.Remove(this.radGridView1.CurrentRow);
Copy[VB.NET] Removing a row from the rows collection
Me.RadGridView1.Rows.RemoveAt(1)
Me.RadGridView1.Rows.Remove(Me.RadGridView1.CurrentRow)