Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,784 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi there,
I'm trying to read a csv to get a formula, e.g. A+B+C or A*B or (A-C)/B (A, B, C is input).
Then, I input A, B, C value in UI, and it can calculate the result automatedly.
Is this possible to do?
Thank you.
Best Regards,
Leon
In case of elementary operations, it is possible to use a DataTable. For example:
string formula = "(A-C)/B";
double A = 123.45;
double B = -0.7;
double C = 9.8;
var dt = new DataTable( );
dt.Columns.Add( "A", typeof( double ) );
dt.Columns.Add( "B", typeof( double ) );
dt.Columns.Add( "C", typeof( double ) );
var rc = dt.Columns.Add( "R", typeof( double ), formula );
dt.Rows.Add( A, B, C );
double result = (double)dt.Rows[0][rc];