Android Question What is the equivilent of '+=' ?

Discussion in 'Android Questions' started by trueboss323, Feb 19, 2015.

  1. trueboss323

    trueboss323 Active Member Licensed User

    Hi , sorry for such a newbish question. I would like to know what is the equilivent for '+=' ?
    For example, I have a button that has the label '1' , so everytime I click it, it would be something like:
    Code:
    Button1.Text += 1
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no such operator in B4A.
    You will need to write:
    Code:
    Button1.Text = Button1.Text + 1
     
  3. trueboss323

    trueboss323 Active Member Licensed User

    Thanks! I tried your code. The only problem is, when I click it, it displays the number with decimals like "2.0 , 3.0, 4.0, etc" is there anyway to make it so it's only displays "2,3,4, etc" ?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Button1.Text = $"$1.0{Button1.Text + 1}"$ '1.0 means that there will be at least one integer digit and at most 0 fraction digits.
    Or use NumberFormat keyword.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice