Is there any way I can create my own named formula using code for the calculation? In other words, define a name with operands and have WinCalcManager call a delegate (which I would provide) to do the actual calculation. The delegate method would return the result.
You can define your own named formula by subclassing the UltraCalcFunction class. The API documentation of the UltraCalcFunction class (link taken from our online help documentation for NetAdvantage for .NET 2008 Volume 3) provides an example of implementing a "factorial" formula. This example also demonstrates how to calculate the result of the custom formula.
Once you've created a custom formula and include it in a project, you can use it in any way where you would use one of the built-in formulae.
I looked at that documentation, but it does not give me an example of what I need. I was wondering if you know of an example like the choose function that allows for dynamic args and no max arg.
Thanks.
Hi,
If you want to have an unlimited number of arguments to a function, you could return int.MaxValue for the MaxArgs.
Also, bear in mind that a single argument could be a list. For example, an arg could be a grid column, which is a list of references of each cell in that column.
I assume that a choose function would take 2 args, the first would be the index and the second would be a list.