Results 1 to 3 of 3

Thread: How to do appending in calculation code

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    Kitchener, Ontario, Cananda
    Posts
    33

    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

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    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.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2004
    Location
    Kitchener, Ontario, Cananda
    Posts
    33

    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
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width