Android Question Button text not showing up

anaylor01

Well-Known Member
Licensed User
Longtime User
What am I doing wrong? The text is not updating. I checked it and it returns the text I want it to it just isn't changing the text of the button.
btngameplay.Initialize("")
btngameplay.Text = "Team " & SQL1.ExecQuerySingleResult("SELECT distinct teamname FROM tblTeamNames tn join tblgamesettings gs on tn.gameid = gs.id where tn.id = 1") & " start"
 

klaus

Expert
Licensed User
Longtime User
I suppose that btngameplay is defined in a layout file.
If yes, you must delete btngameplay.Initialize("").
When you load a layout file all views are automatically initialized.
If not you must add the button on the Activity or a Panel.
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
It is giving me the error that the button needs to be initilized first. Here is my code.
Sub rbtNameTeamNo_CheckedChange(Checked As Boolean)
If lblNumberOfteams.Text = "Play Bonus round?" Then
SQL1.ExecNonQuery("Update tblGameSettings set BonusRound = 'NO'")
BonusRound = "NO"
rbtNameTeamNo.Checked = False
lblNumberOfteams.Text = "Save settings?"
rbtNameTeamYes.Text = "Yes"
rbtNameTeamNo.Text = "No"
rbtNameTeamYes.Visible = True
rbtNameTeamNo.Visible = True
lblNumberOfteams.Visible = True
Else
If lblNumberOfteams.Text = "Save settings?" Then
Activity.LoadLayout("lytGamePlay")
'Msgbox(SQL1.ExecQuerySingleResult("SELECT distinct teamname FROM tblTeamNames tn join tblgamesettings gs on tn.gameid = gs.id where tn.id = 1"),"TEST")
If SQL1.ExecQuerySingleResult("SELECT count(gamename) FROM tblGameSettings where gamename is null") = 0 Then
SQL1.ExecNonQuery("Update tblGameSettings set gamename = 'DEFAULT' where gamename is null")
SQL1.ExecNonQuery("Update tblTeamNames set gameid = " & SQL1.ExecQuerySingleResult("SELECT id FROM tblGameSettings where gamename = 'DEFAULT'") & "")
'btngameplay.Initialize("")
Activity.LoadLayout("lytGamePlay")
btngameplay.Text = "Team " & SQL1.ExecQuerySingleResult("SELECT distinct teamname FROM tblTeamNames tn join tblgamesettings gs on tn.gameid = gs.id where tn.id = 1") & " start"
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
Still isn't working. Here is the code. The msgbox works. If I don't initialize the button it gives me an error stating I need to initialize the button.
Activity.RemoveAllViews
Activity.LoadLayout("lytGamePlay")
btngameplay.Initialize("")
btngameplay.Text = "Team " & SQL1.ExecQuerySingleResult("SELECT distinct teamname FROM tblTeamNames tn join tblgamesettings gs on tn.gameid = gs.id where tn.id = 1") & " start"
Msgbox("Team " & SQL1.ExecQuerySingleResult("SELECT distinct teamname FROM tblTeamNames tn join tblgamesettings gs on tn.gameid = gs.id where tn.id = 1") & " start","test")
End If
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
I created a layout using the designer. Then I added the button. Under Sub Globals I have this. Private btngameplay As Button. So what am I missing?
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
Damn. You were right. I had it named wrong. Question. In the designer. I added the button then tried to generate members but it didn't do it. Why would that be?
 
Upvote 0
Top