Calculator
-
Just out of curiosity I downloaded the library you mentioned and it works for me. This is my small test:
info.lundin.Math.ExpressionParser exp = new info.lundin.Math.ExpressionParser();
Hashtable h = new Hashtable();
h.Add("x", "1");
h.Add("y", "1,5");
h.Add("z", "0,23");double result = exp.Parse("x + y + z", h);
MessageBox.Show(result.ToString());The result is 2,73 -just as expected. EDIT: If you want to take the expression directly from a textbox, use this code:
info.lundin.Math.ExpressionParser exp = new info.lundin.Math.ExpressionParser();
Hashtable h = new Hashtable();
double result = exp.Parse(myTextBox.Text, h);
MessageBox.Show(result.ToString());This also works for me. However (just a guess), you might get that error because you are using incorrect decimal separator for your culture. On my machine the comma is the separator, but for you it might be the dot. Check it.
Thanks very mutch blackjac But it still not work if i use dot ex. 1.4 then it takes it like 14 and if i use 1,4 coms with error "No value associated with 1,4"
-
thaks very mutch but you do not have som method like double.parse(textbox.text) or somthing like that som can help me out of here. I used Inof.Lundin.Math but this cannon add decimal this can just add 1+1 = 2 but not 1+1,4 = 2,4
-
2,4 is not a valid decimal/floating-point-number in most cultures.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)i use a culture en US ? in my web.aspx project.
-
i use a culture en US ? in my web.aspx project.
-
Then you need a dot '.' not a comma ',' eg 2.453
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)Now it works.. thank thanks very much..
-
Now it works.. thank thanks very much..
-
Burim Rama wrote:
thank thanks very much..
No problem, was easy once I had all the info :)
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)somtimes you can use lot of time with som easy code
-
Hey I have a textbox with values = 1 + 1,3 + 1 + 7 How can i calculate that so when i push the button calculate will give the result = 10,3 Thanks very very mutch its really importing
Burim Rama wrote:
its really importing
:laugh::laugh::laugh: You mean important :rolleyes:
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
i use a culture en US ? in my web.aspx project.
Burim Rama wrote:
i use a culture en US ?
Decimals are not done with commas in the US :suss:
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
Hey I have a textbox with values = 1 + 1,3 + 1 + 7 How can i calculate that so when i push the button calculate will give the result = 10,3 Thanks very very mutch its really importing
do you want to put all together on the screen? 1 + 1,3 + 1 + 7 if not add a button "=" use: int total; click button "=" event (or other) inside put: total = total + convert.toint32(textbox_x)
nelsonpaixao@yahoo.com.br trying to help & get help