How to do appending in calculation code
for example. if I had in a program a 1,2,3 button and a plus operator button and two display txt boxes. I want to retain what I a madding in the one text box box. for example if I have 1+2+2 = 5, how ever I want keep this information display in thte one text box, and if I was to ad a - button and use it with the about number example 1+2+2 =5 -1-2 = 3 (ignor the = just for show) I know you have to append the code but not sure how to
txtOutPut.text = ? retaining information in Output text box. Below are code for the + and 7 buttons so you can see what I hav done.
PrivateSub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
If clearDisplay Then
txtInput.ResetText()
clearDisplay = False
EndIf
txtInput.Text = txtInput.Text + sender.Text
If txtInput.Text = TrueThen
txtOutput.Text = txtInput.Text
EndIf
PrivateSub btnPlus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlus.Click
operand1 = Val(txtOutput.Text)
operator = "+"
clearDisplay = True
If txtInput.Text = TrueThen
txtOutput.Text = txtOutput.Text & "+"
EndIf
I hope this maks sense?
In Short I want to keep the calculation I am doing in one text box that is visiable as you are preforming calculatings, until you hit the clear button
Regards
Marcus
Re: How to do appending in calculation code
Hi,
Not sure if I fully understand what you want to see but instead of
txtInput.Text = txtInput.Text + sender.Text
Try
txtInput.Text = txtInput.Text & sender.Text
Use + only as an arithmetical operator, not for concantation.
1 Attachment(s)
Re: How to do appending in calculation code
Hello
I think I get what your saying, but to show what I am looking to do I have done a screen shot of the program witht numbers I typed in place to better show what I am wanting to do.
I had to zip the powerpoint file as it was not seeing it?
Thank you
Marcus