473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

a vb calculator, but with a twist.??

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?

Apr 28 '07 #1
3 1198
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.
"Ron" <pt*****@yahoo.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
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?

Apr 28 '07 #2
"Rob ^_^" <ie**********@hotmail.comwrote in
news:uq**************@TK2MSFTNGP02.phx.gbl:
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...20Started%20-%
20How%20to%20use%20dotMath&referringTitle=Home

Apr 29 '07 #3
Ron,

This kind of programming has the name evaluating.

http://www.vb-tips.com/dbpages.aspx?...1-2b03e1a439ae

You can search for "eval" for more of this,

Cor

"Ron" <pt*****@yahoo.comschreef in bericht
news:11**********************@n76g2000hsh.googlegr oups.com...
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?

Apr 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rafael | last post by:
Hi Everyone, I need some help with my calculator program. I need my program to do 2 arguments and a 3rd, but the 3rd with different operators. Any help would be great. Here is my code.... ...
3
by: Paul | last post by:
I want to make a simple calculator program but dont know where to get started. This is not GUI but a simple terminal program. It would get input like this Enter number: 5 + 10
3
by: Art | last post by:
Hi, In part of my application the user may need to do a simple arithmetic calculation in order to get the value to put in a text box. I was thinking that it would be good if I could display the...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
19
by: TexasNewbie | last post by:
This was originally just a calculator without a decimal point. After I added the decimal, it now tells me invalid second number. //GUI Calculator Program import javax.swing.*; import...
5
Deathwing
by: Deathwing | last post by:
Hi everyone one I'm playing around with trying to make an expense calculator. I would like it so that the user can keep enter expenses until they have no more expenses. Then I would like for the...
3
by: itsmichelle | last post by:
This is a very primative code of a java swing calculator. I have assigned all the number buttons and the operator buttons and I can add, subtract, multiply, and divide two numbers together. However,...
3
by: mandy335 | last post by:
public class Calculator { private long input = 0; // current input private long result = 0; // last input/result private String lastOperator = ""; // keeps track of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.