For the life of me I cannot find my code from over a decade ago(VB). All im trying to do is right a simple math code.
One Label -- For Score
Text Box -- Enter Points you get
Button -- Submits the points goes to label and clears textbox.
Repeat until a certain number is reached.
Heres some of the stuff i have tried (its laughable big brain fart happening here)
B4X:
Private lblscoreone As Label
Private txtscoreone As B4XFloatTextField
One Attempt was
Private btnaddone As Button
Private n As String
Private x As String
One Attempt was(Gave me nothing good
Sub btnaddone_click
n = txtscoreone.text
x = lblscoreone.text
lblscoreone.Text = (x+n)
End Sub
Another Attempt
Sub btnaddone_click
lblscoreone.text = txtscoreone.text (This gives me same number)
lblscoreone.text = txtscoreone.text + txtscoreone.text (obviously doubles crazynes)
End Sub
another attempt
Sub btnaddone_click
lblscoreone.text = x
n = txtscoreone.text
lblscoreone.Text = (x+n)
n = "" (Clear the N so it can count and not double if you pick a one or two)
End Sub
You're a bit vague with your desired objective , but this will probably spur some added detail of what your trying to do ...
B4X:
Private btnAddOne As Button
Private txtScoreOne As B4XFloatTextField
Private lblScoreOne As Label
Private Total As Int
Private Target As Int = 500
Private Sub btnAddOne_Click
If txtScoreOne.text > 0 And IsNumber(txtScoreOne.Text ) And Total + txtScoreOne.Text < Target Then
lblScoreOne.Text = NumberFormat(Total + txtScoreOne.Text, 0, 0)
Total = lblScoreOne.Text
txtScoreOne.Text = ""
Else
Log("You have exceded the target score ...")
End If
End Sub
*ps I have edited your view names to be more readable.