Share via


Dynamically Creating and saving formula using C# code

Question

Thursday, August 20, 2009 6:04 AM

Hi

I am working a C#.NET 3.5 application. I want to create complex formula using the values shown on the screen and save  in XML or Database.

Eg:

Formula1 = (Value1 * Value2 + Value3)/Value6  - Value5

Formula2 = If (Value1 > 1000) then (Value1 * Value2 + Value3)/Value6  - Value5
  else (Value3 * Value2 + Value1)/Value5  - Value6

For the given values, User should have an option to select the foruma from the list and do the calculation by clicking calculate button.

I also need an option to select the same formula and edit and then save.

How to create and save formulas using C# code?

How to give  options to users to add operators like +,-,*,/ and braces while creating the formula?

Thanks
Ashok

All replies (1)

Thursday, August 20, 2009 11:42 AM âś…Answered

 A quick Google search on the topic presented the following sample project: http://www.codeproject.com/KB/recipes/dynamicformula.aspx