我有一个表达式v((P1*P46)/3600)
,其中 p1 来自一个文本框,而 p46 来自另一个文本框
例如:
v((2.0*3.2)/3600)
我该如何计算呢?
这是我的代码:
Private Function calculatevitalexpression(ByVal strformulla As String, ByRef numtxt As TextBox, ByRef dtable As DataTable)
Try
strformulla =v((2.0*3.2)/3600)
Dim Sc As New MSScriptControl.ScriptControl
Sc.Language = "VBSCRIPT"
strformulla = RemoveCharacter(strformulla, "P")
Dim res As Double = Convert.ToDouble(Sc.Eval(strformulla))
Dim result As Decimal = Math.Round(res, decimalplaces)
numtxt.Text = result
Finally
'frmW.Close()
End Try
End Function