your foreach
loop will assign textbox1.Text
each time, so it's perfectly normal that only the last cat
in this.ini.iniGetCategories()
will be used to assign a retrieved value to the TextBox
.
If I'm correct in assuming, that you'd like to have ALL category names in that TextBox
, you would first construct a String
(using either the +=
operator or, preferably, using the StringBuilder
class and only AFTER the scope of the foreach
loop ends would you then assign that string to the Text
property of your TextBox
.
An easy and readable way to achieve this, is to use double nested loops.
the general idea is: for each section in the collection of sections, then for each key in the collection of keys for that specific section