[RESOLVED] Ini file / Multiple entries in a key name
Using GetPrivateProfileString I load some data from a ini file.
I would like to include, under the same key name a number of strings to be assigned to a string array of variable dimension. How do I specify the key name (or how do I loop) so that all lines below (until the next key name) are read and assigned to the different array elements?
Re: Ini file / Multiple entries in a key name
myvalue = a,b,c,d,e,f,g
Get the value and split it into array.
You may need to find delimeter character that is not part of your string.
Re: Ini file / Multiple entries in a key name
You can,
Code:
StringArray1 =Join(aStringArray1, ";")
'WritePrivateProfileString Section, Key, Value, Filename
WritePrivateProfileString "MyStringArrays", "StringArray" & 1, StringArray1, app.Path & "/A.ini"
'GetPrivateProfileSection(Section, Key, tDefault, RetVal, BufferLen, Filename)
GetPrivateProfileSection "MyStringArrays", "StringArray" & 1, " ",TempStringArray ,?,app.Path & "/A.ini"
aStringArray1 =Split(TempStringArray, ";")
Re: Ini file / Multiple entries in a key name
So both of you guys suggest the same straightforward solution. The easier it turns out to be the less likely I am to think of it myself :blush:
Thanks be to you both.