I'm trying to take the section from an Ini file and add it into a list then ultimately, add the list to a ComboBox. I found how to add the values of the Section but I cannot find how to just retrieve the Section. For example, I want just the city names from below:
[Toronto] population: 10
[Vancouver] population: 4
Then my List would by [Toronto, Vancouver]. Seems like all the IniFile.Read* just reads the keys and not the section. Any pointers would be appreciated
CodePudding user response:
You can use TIniFile.ReadAllSections
to retrieve the name of all sections into a TStrings
descendant, which could be the ComboBox.Items
.
ComboBox1.Items.Clear;
Ini.ReadAllSections(ComboBox1.Items);