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;
View.BeginSort();
try
{
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;
}
}finally{
View.EndSort();
}
when I run the program, I get the below exception.
Cannot apply operator "+=" to operands of type 'Object' and 'Decimal'
Please assist.
Thanks
Peter
Amit GuptaPosted Aug 31, 2016, 4:04 PM
Peter DzuyaPosted Sep 1, 2016, 1:48 AM