Peter Dzuya

Peter Dzuya

  • 1.8k
  • 171
  • 30k

Traversing through Rows in a grid

Aug 31 2016 2:50 PM
Hi All, 
I wish to sum up all credits that I have already filtered in a grid. I have written this code as shown below:-
DevExpress.XtraGrid.Columns.GridColumn col = View.Columns.ColumnByFieldName("Credit");
if (col == null)return;
int dataRowCount = View.DataRowCount;
for (int i = 0; i < dataRowCount; i++)
object cellValue = View.GetRowCellValue(i, col);
decimal totalcredit = Convert.ToDecimal(cellValue);
barEditItemCredit.EditValue += totalcredit;
 when I run the program, I get the below exception.
Cannot apply operator "+=" to operands of type 'Object' and 'Decimal' 
Please assist.

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (2)