2011-10-11 6 views
0

utilisant VB.Net (application Windows)calcul des valeurs de la formule

Tableau 1

ID Formula 

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

de l'entrée utilisateur

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

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

Conditons

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 

.... 

Je veux prendre une formule en fonction de leur identifiant, alors je veux pour passer la valeur a = textbox2.text, b = textbox3.text, c = textbox4.text

code

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

si la formule est stockée dans f1, alors je veux passer la valeur entrée d'utilisateur

par exemple

f1 = a + b * c signifie que je dois passer la valeur a = TextBox1.Text, b = textbox2.text, c = textbox3.text

Comment faire.

Besoin d'aide VB.Net code

Répondre

1

Voici un site qui a le code source pour ce faire, bien qu'il soit en C#: Eval Class

Questions connexes