MarcusBell
Member
- Joined
- Feb 1, 2005
- Messages
- 12
- Programming Experience
- Beginner
How do you do an appending 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.
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
If clearDisplay Then
txtInput.ResetText()
clearDisplay = False
End If
txtInput.Text = txtInput.Text + sender.Text
If txtInput.Text = True Then
txtOutput.Text = txtInput.Text
End If
Private Sub 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 = True Then
txtOutput.Text = txtOutput.Text & "+"
End If
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
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.
Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
If clearDisplay Then
txtInput.ResetText()
clearDisplay = False
End If
txtInput.Text = txtInput.Text + sender.Text
If txtInput.Text = True Then
txtOutput.Text = txtInput.Text
End If
Private Sub 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 = True Then
txtOutput.Text = txtOutput.Text & "+"
End If
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