Use the events of the GridView:
RowClick and
FocusedRowChanged.
By example:
private void myGrid_RowClick(object sender, DevExpress.XtraGrid.Views.Base.RowClickEventArgs e) {
if (e.RowHandle < 0) {
} else {
register = (MyClass)myGrid.GetRow(e.RowHandle)).ShallowCopy();
oneValueOfCellOfRow = myGrid.GetRowCellValue(e.RowHandle, "OneNameOfFieldNameOfGrid");
}
}
private void myGrid_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) {
if (e.FocusedRowHandle < 0) {
} else {
register = (MyClass)myGrid.GetRow(e.FocusedRowHandle));
oneValueOfCellOfRow = myGrid.GetRowCellValue(e.FocusedRowHandle, "OneNameOfFieldNameOfGrid");
}
}
Attention:
When i asign the DataSource to Grid, i assing to DataSource a List of MyClass
List<myclass> data = new List<myclass>();
...
myGrid.DataSource = data;
</myclass></myclass>