【问题标题】:calculating the values from the formula从公式计算值
【发布时间】:2011-12-05 00:33:25
【问题描述】:

使用 VB.Net(Windows 应用程序)

表1

ID Formula

001 a+b+c
002 a-b*c
003 a*b
004 a/b
...
...

用户输入的

Textbox1.text = id of the formula (users input)

Textbox2.text = value1
textbox3.text = value2
textbox4.text = value3

条件

If the user enter the value in the textbox1.text = 001 
then it will add 3 value (textbox2.text + textbox3.text, + textbox3.text), because user selected the formula1

If the user enter the value in the textbox1.text = 003 
then it should multiply (textbox2.text * textbox3.text), because user selected the formula2

....

我想根据他们的id取一个公式,然后我想传递值a = textbox2.text, b = textbox3.text, c= textbox4.text

代码

cmd = "Select Formula from table1 where id = '" & textbox1.text & "'"
dim f1 as string
f1 = cmd.executescalar

所以公式存储在f1中,然后我想传递用户输入的值

例如

f1 = a + b * c 表示我必须传递值 a = textbox1.text, b= textbox2.text, c = textbox3.text

如何做到这一点。

需要 VB.Net 代码帮助

【问题讨论】:

    标签: vb.net


    【解决方案1】:

    这是一个包含执行此操作的源代码的站点,尽管它是在 C# 中的:Eval Class

    【讨论】:

      猜你喜欢
      • 2021-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-13
      • 1970-01-01
      • 2018-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多