Home Forums WinForms controls Xceed Grid for WinForms GUI Test Automation Reply To: GUI Test Automation

User (Old forums)
Post count: 23064

To find the cells programmatically, you could loop over the DataRows, and for each DataRow, loop over the Cells. If you want to get the rows in the same order as on screen, use the GetSortedDataRows method. Here’s some (untested) code:<code>foreach(Xceed.Grid.DataRow row in grid.GetSortedDataRows(true))
foreach(Xceed.Grid.Cell cell in row.Cells)
cell.EnterEdit(); // activate the cell editor of the cell
Xceed.Grid.ICellEditor editor = cell.CellEditor;
… // do stuff with the editor
cell.LeaveEdit(true); // de-activate the cell editor and commit the value to the cell
If you don’t need the cell editor, and you just want to manipulate/examin the value of the cells, you don’t need the <i>cell.EnterEdit() … cell.LeaveEdit(true)</i> block: you can just use the property <i>cell.Value</i>.

Imported from legacy forums. Posted by Tommy (had 235 views)