hello everyone =)

can someone help me please to solve somthing..?
I have difficulties in my calculator program.
I am using the 2005/2008 edition of vb express.

I created a calculator with only one textbox, and i can't figure it out how to insert 2 values and make the arithmetic operation work.
i have succeeded to insert one value, but i need that the number on the textbox will remain even if i press the (+,-,/ etc) and just when i will start to insert an other value so the previous one will disappear and the new one will display on the textbox and the secoend variable will get the value so i can make the arithmetic operation.

thanks a lot for your help.

I'm not going to build the calculator for you, but here is a project that basically does what you want, but only adds up the sum. First, type a number in the bottom box, and then click the button. Type another number in the bottom box, and click the button... etc, etc. You'll see that it displays the current running total/sum, and it also shows you (in another label) the "Old Value" which is the value that was erased from the top textbox (textbox1), but still stored so that it can get added to.

I'm not going to build the calculator for you, but here is a project that basically does what you want, but only adds up the sum. First, type a number in the bottom box, and then click the button. Type another number in the bottom box, and click the button... etc, etc. You'll see that it displays the current running total/sum, and it also shows you (in another label) the "Old Value" which is the value that was erased from the top textbox (textbox1), but still stored so that it can get added to.

thanks a lot for the effort, but the problem is how can i do it with only one text box (like calculator have).
i know all the rest.. just this one fail me.. :(
and again - thank u very very much... XD

wow! i still can't do that..
i have attached the program that i created.
only the buttons 1 and 2 are activated and the + and = operations in order to solve this first and afterwards the rest is easy..

how can i in my program make 2 variables that the first one get the value of the textbox and after i click on the "+" button the textbox still remain displaying the value and just when i will start to enter the second value the text box will show the second one that you type on the screen.
the old one will be the first variable and the new one the second.
and then after u have the 2 values u can do the arithmetic operation.

please help me.. i am begginer and i work on this one without solve it for 2 weeks!! (1-2 hours a day)!
knowledge is power.. please share =)

To do what you ask you can make global variables and have in your button click

variable1 = txtTextbox.Text

reset the textbox if you so choose and for button 2 then

variable2 = txtTextbox.Text

Since you don't want to do it that way then you're going to either have to keep it all together by adding every button on the form and having people enter the button to get a value and translate the box into a string and substring or parse it out or keep a separate variable for the display

display = variable1 + "+" + variable2 or something of that sort

then after hitting your button set the textbox to display the display variable

thank a lot again..

i see that i have little diffulties to explain so i have attached the desired calculator that i am trying to create..

u can see that when u press a number it's diplayed on the txtbox and after u choose an operator the number still remain, and just after u start the new number (that the second variable get it's value) the number disappear and the new one diaplay on the same txtbox. and the "=" button is turn into enable as well..

u can look at what i was doing in my program and see what u shouldn't do.. :(

anyway, if someone can give me further instruction, i will be more than pleased.. :)

thanks a lot for all the answers, specially for the desired one.. =)

What exactly are you asking for? You want me to code it for you and give that to you? Or are you asking for the logic to do the program?

(By the way, I'm don't run .exe files from forums. If you want to post a pic of it or something that's fine)

I don't know..
a picture will not solve the problem and i understand your point of view about the exe file..

if u can help with the code, so u r great..
because the logic i can't undrerstand.. or to translate the it to the program.

anyway i thought it's somthing tiny to solve..
and once again.. thank u.. i really appreciate the effort even if u can't help me further..

I can help you, I can do the entire thing here is the problem:

You're not learning anything if I just give you the code. Yes it helps to see code sometimes, but you have to understand basic concepts and put forth some effort first.

Help us help you by spending some more time on it and let us know what you have.

u must be right..
i'll do my best before, i always have new ideas but i'm short on time due to the fact that i am close to be desperate from tries..

when i'll be more proffessional in vb and java i will help other people like u did, because it make me so happy to know that there is good people in the world...

thank u so much.. and have an happy good year.. XD
yours sincerely, Eitan.

This question has already been answered. Start a new discussion instead.