Lainkes 0 Posted August 18, 2022 Hello, On my form (Person) , I have a Listbox component that I fill with values from another table. I activated the multiselect option. How can I now save the selected records in my database, linked to the Person. When I open the Person form again, the selected records needs to be selected. Thanks Lainkes Share this post Link to post
Lainkes 0 Posted August 18, 2022 I found a component that is called TCheckListBox. I can fill this with values from my database. So that's works fine. Now I need to know how to save the selected data to my database, linked to the key of my Person table. Share this post Link to post
Gary 18 Posted August 18, 2022 Use the TCheckListBox.Selected Property Here is an example from the documentation: https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/FileListBox_(Delphi) Share this post Link to post
Lainkes 0 Posted August 19, 2022 I already managed to fill the Checkboxlist with items from my table. But now I'm wondering how I can write the selected items to a table and retrieve them when a person form is opened. Thanks Share this post Link to post
Gary 18 Posted August 19, 2022 You iterate over the items, check if it's checked if it is, save it to your table for var i := 0 to (FileListBox1.Items.Count - 1) do begin if FileListBox1.Selected[i] then begin // save item to table FileListBox1.Items[i] end; Share this post Link to post