My C# help thread

Soldato
Joined
18 Aug 2006
Posts
10,048
Location
ChCh, NZ
Since my post a few days ago I've decided to make my own help thread where some of you more experience guys can nudge me into the right direction when I run into any problems.....like now.

I'm busy coding a calculator and it's been going well but I've run into a silly problem that's actually embarrassing. I cannot figure out how to input more than 1 digit into the calculator with buttons. :o

textBox1.Text = "8"; - that's when I click the button numbered "8" (duh), however when I next click number 5 for instance, it clears the 8 and the 5 is the only digit remaining. It keep on happening with all the buttons.

I can input directly into the textbox with the keyboard and calculate anything, but would like to do it from the buttons on the main form.

help. :D

:o
 
regulus said:
Since my post a few days ago I've decided to make my own help thread where some of you more experience guys can nudge me into the right direction when I run into any problems.....like now.

I'm busy coding a calculator and it's been going well but I've run into a silly problem that's actually embarrassing. I cannot figure out how to input more than 1 digit into the calculator with buttons. :o

textBox1.Text = "8"; - that's when I click the button numbered "8" (duh), however when I next click number 5 for instance, it clears the 8 and the 5 is the only digit remaining. It keep on happening with all the buttons.

I can input directly into the textbox with the keyboard and calculate anything, but would like to do it from the buttons on the main form.

help. :D

:o

Textbox.Text+="5";

?
 
various ways. appending to a string makes a lot of sense. just cast it when you want to perform an operation on it.
 
Back
Top Bottom