ElliotHC Active Member Licensed User Aug 8, 2019 #1 I have a save config routine which looks at the state of some checkboxes along with some textfield values and saves them to a file. Text is saving fine but for some reason I can't seem to get the checkbox value.. It always returns false even when it's ticked. Elsewhere in my code I'm using an if statement e.g. Code: Copy If Checkbox1.checked = True then 'DO CODE HERE End If This is working fine. But when I do this Code: Copy Writer.Writeline("CheckBox Value," & CheckBox1.Checked) I always write false
I have a save config routine which looks at the state of some checkboxes along with some textfield values and saves them to a file. Text is saving fine but for some reason I can't seem to get the checkbox value.. It always returns false even when it's ticked. Elsewhere in my code I'm using an if statement e.g. Code: Copy If Checkbox1.checked = True then 'DO CODE HERE End If This is working fine. But when I do this Code: Copy Writer.Writeline("CheckBox Value," & CheckBox1.Checked) I always write false
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2019 #2 The problem is somewhere else. Checbox.Checked will return True or False based on the value. It will be converted to string automatically. Upvote 0
The problem is somewhere else. Checbox.Checked will return True or False based on the value. It will be converted to string automatically.
E emexes Expert Licensed User Longtime User Aug 8, 2019 #3 Edit: ignore this question - I was not aware that the issue had been resolved in another thread. Where I was heading was that if the "&" somehow slipped through to the Java intermediate code as a boolean AND operator rather than a string concatenation operator, then the output might well just be the word "false" rather than "CheckBox Value,True"... which would have been mighty interesting ;-) ElliotHC said: when I do this Code: Copy Writer.Writeline("CheckBox Value," & CheckBox1.Checked) I always write false Click to expand... Just in case the impossible is happening: what precisely is that WriteLine writing (the entire line, from start to end)? Last edited: Aug 8, 2019 Upvote 0
Edit: ignore this question - I was not aware that the issue had been resolved in another thread. Where I was heading was that if the "&" somehow slipped through to the Java intermediate code as a boolean AND operator rather than a string concatenation operator, then the output might well just be the word "false" rather than "CheckBox Value,True"... which would have been mighty interesting ;-) ElliotHC said: when I do this Code: Copy Writer.Writeline("CheckBox Value," & CheckBox1.Checked) I always write false Click to expand... Just in case the impossible is happening: what precisely is that WriteLine writing (the entire line, from start to end)?
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2019 #4 This is a duplicate thread: https://www.b4x.com/android/forum/threads/checkbox-value.108450/ Upvote 0