2012-02-29 11 views
0

私は、マイナスがFastReport.Netのフッタに値するようにしたいと思います。 私のコード:FastReport.netのマイナス2の値

private void PageFooter1_BeforeLayout(object sender, EventArgs e) 
    { 
     Text22.Text=Convert.ToString(Convert.ToDouble(Text12.Text)-Convert.ToDouble(Text3.Text)); 
    } 

と、このエラーが発生しました:

FastReport.Net v1.7.33 
Exception has been thrown by the target of an invocation. 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format. 
    at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) 
    at FastReport.ReportScript.PageFooter1_BeforeLayout(Object sender, EventArgs e) 
    --- End of inner exception stack trace --- 
    at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
    at FastReport.Code.ExpressionDescriptor.Invoke(Object[] parameters) 
    at FastReport.BandBase.CalcHeight() 
    at FastReport.Engine.ReportEngine.ShowBandToPreparedPages(BandBase band, Boolean getData) 
    at FastReport.Engine.ReportEngine.ShowBand(BandBase band, Boolean getData) 
    at FastReport.Engine.ReportEngine.EndLastPage() 
    at FastReport.Engine.ReportEngine.RunReportPage(ReportPage page) 
    at FastReport.Engine.ReportEngine.RunReportPages() 
    at FastReport.Engine.ReportEngine.RunReportPages(ReportPage page) 
    at FastReport.Engine.ReportEngine.Run(Boolean runDialogs, Boolean append, ReportPage page) 
    at FastReport.Report.Prepare(Boolean append) 
    at FastReport.Design.ReportTab.Preview() 

誰も私を助けることができますか?

答えて

1

DataTextFormatString="{0:Axx}"を試して、BeforePrintイベントにコードを挿入してみてください。例えば

private void Text14_BeforePrint(object sender, EventArgs e) 
{ 
    Text14.Text=string.Format("{0:N}",((Decimal)Report.GetColumnValue("Table.money"))-((Decimal)Report.GetColumnValue("Table.TRSMONEY"))); 
}