a vb calculator, but with a twist.??

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

Hello,
I made a vb calculator just a simple one using code like this.

ansmult = txtinput.text * txtinput.text
ansplus = txtinput.text + txtinput.text

but my calculator works like this. I enter in a number say 20 when I
hit the + , *, -, / operator signs, the 20 goes away from the testbox
and I can now choose to enter in another number.

I want to build a calc where If I press buttons 20 * 2 =

my display box will display 20 * 2 = 40

so it will display everything I press not just an answer.

Can anyone explain or give an example of how I would do this?
 
Hi Ron,

You will have to parse the input text as the keys are pressed and separate
them into numbers and operands. You could then display the output in a
scrolling text box.
eg.
8 * 4
- 8 (user presses enter here)
(8*4)-8=24

BTW. Did you know google has a built in calculator
http://www.google.com/search?q=20*4-8

Regards.
 
Hi Ron,

You will have to parse the input text as the keys are pressed and
separate them into numbers and operands. You could then display the
output in a scrolling text box.
eg.
8 * 4
- 8 (user presses enter here)
(8*4)-8=24

BTW. Did you know google has a built in calculator
http://www.google.com/search?q=20*4-8


There are a few .NET math libraries out there. I believe some of these
libraries have the parsing built in (i.e. dotMath):

http://www.codeplex.com/dotMath/Wiki/View.aspx?title=Getting Started -%
20How%20to%20use%20dotMath&referringTitle=Home
 
Back
Top