0

Hi - I have the below code to calculate EI2/MV2. The code works for subtotal when the numerator is 0 but it does not work for grandtotal so when my grandtotal numerator EI2 is 0 it gives "Exception has been thrown by the target of an invocation". Does anyone know how i can get around that? THank you

decimal EI2;
decimal MV2;

DataDynamics.ActiveReports.TextBox TBV2;
DataDynamics.ActiveReports.TextBox TBY2;

TBY2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox9"];

TBV2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox8"];
MV2 = System.Convert.ToDecimal(TBV2.Value);

TBV2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox20"];
EI2 = System.Convert.ToDecimal(TBV2.Value);

{
if (MV2 != 0)
{
    TBY2.Value = (EI2 / MV2) * 100;
}
else
{
    TBY2.Value = 0;
}
} 
2
Contributors
1
Reply
15
Views
2 Years
Discussion Span
Last Post by rproffitt
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.