A anaylor01 Well-Known Member Licensed User Longtime User Jan 12, 2016 #1 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"
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 Jan 12, 2016 #2 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
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.
A anaylor01 Well-Known Member Licensed User Longtime User Jan 14, 2016 #3 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
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"
LucaMs Expert Licensed User Longtime User Jan 14, 2016 #4 I see two: Activity.LoadLayout("lytGamePlay"). Anyway, if you have loaded another layout before, use Activity.RemoveAllViews, before loading lyGamePlay. Note that the views of lyGamePlay should be declared in Globals. Upvote 0
I see two: Activity.LoadLayout("lytGamePlay"). Anyway, if you have loaded another layout before, use Activity.RemoveAllViews, before loading lyGamePlay. Note that the views of lyGamePlay should be declared in Globals.
A anaylor01 Well-Known Member Licensed User Longtime User Jan 14, 2016 #5 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
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
LucaMs Expert Licensed User Longtime User Jan 14, 2016 #6 btngameplay can be created (added to an Activity or Panel) by code (only in this case you must inizialize it by code) or by Designer (in this case you do not have to initialize it). In both cases you must declare it (globals). Upvote 0
btngameplay can be created (added to an Activity or Panel) by code (only in this case you must inizialize it by code) or by Designer (in this case you do not have to initialize it). In both cases you must declare it (globals).
A anaylor01 Well-Known Member Licensed User Longtime User Jan 14, 2016 #7 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
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?
LucaMs Expert Licensed User Longtime User Jan 14, 2016 #8 anaylor01 said: It is giving me the error that the button needs to be initilized first Click to expand... If so, check the name of the button in the Designer (and the name of the layout). Upvote 0
anaylor01 said: It is giving me the error that the button needs to be initilized first Click to expand... If so, check the name of the button in the Designer (and the name of the layout).
A anaylor01 Well-Known Member Licensed User Longtime User Jan 14, 2016 #9 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
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?
LucaMs Expert Licensed User Longtime User Jan 14, 2016 #10 anaylor01 said: 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? Click to expand... You should select (IDE) the Activity module in which the members have to be created. Last edited: Jan 14, 2016 Upvote 0
anaylor01 said: 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? Click to expand... You should select (IDE) the Activity module in which the members have to be created.