# Iterating Cells

You can iterate through the cells of each row using the **Cells** collection of [GridViewCellInfo](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/gridviewcellinfo). The example below firstly iterates the rows of the grid, then the cells for each row:

```C#
foreach (GridViewRowInfo rowInfo in radGridView1.Rows)
{
    foreach (GridViewCellInfo cellInfo in rowInfo.Cells)
    {
        if ((cellInfo.ColumnInfo.Name == "Title")
            || (cellInfo.ColumnInfo.Name == "FirstName")
            || (cellInfo.ColumnInfo.Name == "LastName"))
        {
            cellInfo.Value = "Test Value";
        }
    }
}
```

```VB.NET
For Each rowInfo As GridViewRowInfo In RadGridView1.Rows
    For Each cellInfo As GridViewCellInfo In rowInfo.Cells
        If (cellInfo.ColumnInfo.Name = "Title") OrElse (cellInfo.ColumnInfo.Name = "FirstName") OrElse (cellInfo.ColumnInfo.Name = "LastName") Then

            cellInfo.Value = "Test Value"
        End If
    Next
Next
```

> note  **RadGridView** uses virtualization for its visual elements. This means that only the rows that are currently visible have a visual element. When the grid is scrolled up and down the visual elements are reused. Because of the virtualization, it is safe to use the **CellElement** only inside the **CellFormatting** event and only for the current cell.

## See Also

* [Accessing and Setting the CurrentCell](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/accessing-and-setting-the-currentcell)

* [Accessing Cells](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/accessing-cells)

* [Conditional Formatting Cells](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/conditional-formatting-cells)

* [Creating Custom Cells](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/creating-custom-cells)

* [Formatting Cells](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/formatting-cells)

* [GridViewCellInfo](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/gridviewcellinfo)

* [Painting and Drawing in Cells](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/painting-and-drawing-in-cells)

* [ToolTips](https://www.telerik.com/products/winforms/documentation/controls/gridview/visual-elements/cells/tooltips)
