Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
Set Format of UltraCalcManager for a Control
posted

I am attempting to use an UltraCalcManager to get a SUM() of a few columns from different UltraGrids.  However, instead of placing the result in a column, I'd like to place it in the .Text of a label.  So far, it seems to do the math properly.

There is one little caveat: How do I format the result as currency?  In the UltraGrid, we can do {0:C2} for a summary column.  I do not see any properties that I can set on the UltraCalcManager.

Do I need to handle a particular UltraCalcManager event?

Thanks,
Kyle

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Kyle,

    You can use the FormatValue event of the WinCalcManager to format the value as currency.

    However, you have to be a little bit careful. The WinGrid cell has the ability to store one value and display another. So you can store a value and display it formatted and there's no problem when the CalcManage asks for the Value of the cell, because the format just changes the display and not the value.

    A Label doesn't have this capability. So the FormatValue event will change the value that is being applied to the Text property of the label. If the label is only being used as the target (result) of a formula, then this is no problem. But if you are also using this label as the source value in some other formula, then you will also need to handle the ParseValue event to un-format the string into a numeric value that the CalcManager can use.

Reply Children
No Data