Android Question label text isn't working

anaylor01

Well-Known Member
Licensed User
Longtime User
I am confused as to why the below code doesn't work. The two message boxes work fine. The lblhighscore.text doesn't do anything.

Code:
Msgbox(SQL1.ExecQuerySingleResult("SELECT max(teamscore) FROM GamePlay Limit 1"),"HighScore")
lblHighScore.Text = SQL1.ExecQuerySingleResult("SELECT max(teamscore) FROM GamePlay Limit 1")
Msgbox(SQL1.ExecQuerySingleResult("SELECT max(teamscore) FROM GamePlay Limit 1"),"HighScore")
 
This is one of many reasons to separate data (and their construction / retrieval) from GUI.

If you had:

Dim TeamHighScore As Int = modDB.GetTeamHighScore
(SQL1.ExecQuerySingleResult("SELECT max(teamscore) FROM GamePlay Limit 1") in your modDB module)

lblHighScore.Text = TeamHighScore

you could debug your code, checking the TeamHighScore value
 
Upvote 0
Just a guess, you redimmed or reinitialized lblHighScore somewhere, though it belongs to a layout?
 
Upvote 0
Erel: The output of the log is 80 which is the highscore.
mc73: I am pretty sure I did not. And the code for the label is with the other code on that layout and they work.
 
Upvote 0
And the code for the label is with the other code on that layout and they work.
There is no label in your code in post #1

Create a small project which shows the problem and upload it.
I´m sure the problem is with your code somehow
 
Upvote 0
What do you mean DonManfred? This is a label "
lblHighScore.Text = SQL1.ExecQuerySingleResult("SELECT max(teamscore) FROM GamePlay Limit 1""
 
Upvote 0
Here it is. I deleted it and added a new one and still doesn't work.
Code:
Private lblhighscore1 As Label
 
Upvote 0
If you add a label in code (and not through the designer) you should also initialize it.

Code:
Dim lblHighScore as label
lblHighScore.initialize("")
 
Upvote 0
Back
Top