当我运行以下代码时,我得到了 StackOverFlow 异常。请为此提供解决方案。
private void gridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
double percentageOfProfit = 0.00;
if (gridView.Columns.Contains("TotalAmountPayable"))
{
foreach (DataGridViewRow row in gridView.Rows)
{
if (row.Cells["PercentageOfProfit"].Value.ToString() != "")
{
percentageOfProfit = Convert.ToDouble(row.Cells["PercentageOfProfit"].Value);
row.Cells["AmountPayableToBeneficiary"].Value = totalRevenuePaid * (percentageOfProfit / 100.00);
row.Cells["TotalAmountPayable"].Value = totalRevenuePaid;
}
}
}
}