Gopal
Gopal

Reputation: 11992

calculating the values from the formula

Using VB.Net (Windows Application)

Table1

ID Formula

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

User input's

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

....

I want to take a formula according to their id, then i want to pass the value 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

so formula is stored in f1, then i want to pass the user entered value

for example

f1 = a + b * c means i have to pass the value a = textbox1.text, b= textbox2.text, c = textbox3.text

How to do this.

Need VB.Net Code Help

Upvotes: 0

Views: 816

Answers (1)

briddums
briddums

Reputation: 1846

Here's a site that has source code for doing this, though it is in C#: Eval Class

Upvotes: 1

Related Questions