P Peter Lewis Well-Known Member Licensed User Longtime User Apr 19, 2020 #1 Hi All I have tableview loaded with data from a SQLite Database. No problem, added the extra Field in the Database as Integer Then ran this code which allows me to have the checkbox and I can change the value on screen B4X: Copy Dim m As Map m.initialize m.put(0,"Checkbox") ' columnIndex and node to add DBUTILS.ExecuteTableView3(sql1,"select Checkbox,Name, Cellular, Loginname from friends",Null,0,TableFriends,m) I also have a Checkbox that I have put on the screen for Select all , That works well and I can trap when it is done and update the database no problem , here is the code B4X: Copy Sub CheckBox1_CheckedChange(Checked As Boolean) If Checked = True Then For Each r() As Object In TableFriends.items Dim cb As CheckBox = r(0) cb.checked = True Log("checked") Next Else For Each r() As Object In TableFriends.items Dim cb As CheckBox = r(0) cb.checked = False Log("Unchecked") Next End If Log(cb.Checked) End Sub Now I am trying to trap when one of the checkboxes on the Tableview is checked so that I can update the database with just that one record or possible a few records I have tried multiple things that I though would work but has not yet to date. If you have any suggestions , please Thank you
Hi All I have tableview loaded with data from a SQLite Database. No problem, added the extra Field in the Database as Integer Then ran this code which allows me to have the checkbox and I can change the value on screen B4X: Copy Dim m As Map m.initialize m.put(0,"Checkbox") ' columnIndex and node to add DBUTILS.ExecuteTableView3(sql1,"select Checkbox,Name, Cellular, Loginname from friends",Null,0,TableFriends,m) I also have a Checkbox that I have put on the screen for Select all , That works well and I can trap when it is done and update the database no problem , here is the code B4X: Copy Sub CheckBox1_CheckedChange(Checked As Boolean) If Checked = True Then For Each r() As Object In TableFriends.items Dim cb As CheckBox = r(0) cb.checked = True Log("checked") Next Else For Each r() As Object In TableFriends.items Dim cb As CheckBox = r(0) cb.checked = False Log("Unchecked") Next End If Log(cb.Checked) End Sub Now I am trying to trap when one of the checkboxes on the Tableview is checked so that I can update the database with just that one record or possible a few records I have tried multiple things that I though would work but has not yet to date. If you have any suggestions , please Thank you
Erel B4X founder Staff member Licensed User Longtime User Apr 20, 2020 #2 Peter Lewis said: If you have any suggestions , please Click to expand... Switch to B4XTable. Upvote 0