a vb calculator, but with a twist.??

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?
 
R

Rob ^_^

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top