DevExpress - Set Cell Value - An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
c#, devexpress, gridview
Solution
As say in documentation
The CellValueChanged event fires in response to a cell's value being changed. The list below gives the possible reasons for this event being raised:
- An end-user has closed an in-place editor after changing the editor's value.
- A cell's value has been changed using the methods provided by Views. For instance, the SetRowCellValue method can be used for this purpose.
So you need change your code as suggest docs
private void gv1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
if (e.Column.Caption != "totalvalue") return; // if event in fire from cells in column "totalvalue"
string value1 = Convert.ToString(gv1.GetRowCellValue(gv1.FocusedRowHandle, "unitvalue"));
object cellValue = Convert.ToUInt32(value1) * Convert.ToInt32(days_worked);
gv1.SetRowCellValue(gv1.FocusedRowHandle, "totalvalue", cellValue);
}
Problem
i have this code (gridview, cellvaluechanged event): ``` private void gv1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { string value1 = Convert.ToString(gv1.GetRowCellValue(gv1.FocusedRowHandle, "unitvalue")); object cellValue = Convert.ToUInt32(value1) * Convert.ToInt32(days_worked); gv1.SetRowCellValue(gv1.FocusedRowHandle, "totalvalue", cellValue); } ``` "days_worked" is a value obtain from label control, the value of the cell does not change, appears the following error: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll "totalvalue" is a column of my database Please help, thanks!