# C# Calculator, textbox coding.



## flaxe (Sep 11, 2009)

Hello!

I've just learned some C# programming at school and today we did a very simple calculator 

Well, when I came home today I was thinking of learn me some more C#, and specially make my calculator more advanced.

Well, my code works, but I wan't it to be some shorter. I've tried it pretty much different until I even got it to work correctly ^^

This is my code line for the button:

```
textBox3.Text = Convert.ToString(double.Parse(textBox1.Text) + (double.Parse(textBox2.Text)));
```
What I want is to shorten that line some, I think it possible...

Anyone know how to make that code shorter but still with the same function/"base code"?

I would also like to know how I can make like when I'm writing '10' in the textBox1, and pressed the PLUS button, then the number '10' in the textBox will be removed so I can write another, and then press the Answear button, I think I have to set an variable for that to work, so the numbers got a place to save. I hope you understand what I mean ;P


----------



## igotgame1990 (Sep 21, 2009)

You know, normally I would help you. But I am in the same situation as you. Who know's you might be in my class. You might get a better mark then me. 

haha im just kidding. 

try something like textBox.clear or textBox.show = false


----------

