Counter problems

CoDy

New Member
Licensed User
Longtime User
i new here and i'm having a problem with my counter.
here's what im trying to do.

i have a activity with a button on it and and a counter variable.



When someone click on the button it increments the counter and sends the result to another activity, which then should display it on a label.


However i cannot get the counter to go from one activity to another. I made it Global.

B4X:
'Activity module
Sub Process_Globals
   
Dim qc As Boolean
Dim score As Int : score = 0
End Sub

Public Sub btntrademecheck_click

If txtinput.text.Contains ("trade me") Then
qc = True
score = 1


Msgbox("Correct", "This is the title")

StartActivity("NewZealand")


Else 

qc = False

Msgbox("Wrong", "This is the title")
End If
End Sub
this is the button click event

B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout ("NewZealand")




lblNZscores.Text = NZtrademe.score


End Sub
this is the label stuff i also dont no where to place the code for the label.

lblnzscores is the label i need the score to show up in.
lblnzscore is in the NewZealand activity


btntrademecheck is the button you click on for all this to happen.
btntrademecheck is in the NZtrademe activity

thanks
 

NJDude

Expert
Licensed User
Longtime User
Look at the attached sample.

Also, there are more samples in the forums as well as in the documentation, look at my signature, I have some links there.
 

Attachments

  • Sample.zip
    11.7 KB · Views: 246
Last edited:
Upvote 0
Top