Aidan Kehoe Aidan Kehoe - 1 year ago 161
Ini Question

Create an array in an ini file

I'm programming in and I need to access information from an ini file. There is also some information that I need to insert into the ini file manually so that the program can access it. For example, I need an array

to contain a set of possible file extensions for my program to loop through. How do I manually insert this into an ini file (ie just typing, without using a program)? What is the syntax?

Answer Source

There is no correct syntax for an array, you can place whatever you like as value.
So you could choose whatever syntax you want, for example: Extensions=.ex1,.ex2,.ex3
and in your code you would parse (for this example split) the INI key's value as you need.

The syntax I used was like the following: Extensions={.ex1,.ex2,.ex3}
Also I created an INI library that would enable me to easily manipulate with that value syntax.
For example:

Dim ini As New IniFile()
ini.Load("My Extensions.ini")

Dim extensions As String()
If ini.Sections(0).Keys("Extensions").TryParseValue(extensions) Then
    For Each extension In extensions
End If
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download