ReadIniSection (statement)


ReadIniSection section$,ArrayOfItems()[,filename$]


Fills an array with the item names from a given section of the specified ini file.


The ReadIniSection statement takes the following parameters:






String specifying the section that contains the desired variables, such as "windows". Section names are specified without the enclosing brackets.



Specifies either a zero- or a one-dimensioned array of strings or variants. The array can be either dynamic or fixed.

If ArrayOfItems() is dynamic, then it will be redimensioned to exactly hold the new number of elements. If there are no elements, then the array will be redimensioned to contain no dimensions. You can use the LBound, UBound, and ArrayDims functions to determine the number and size of the new array's dimensions.

If the array is fixed, each array element is first erased, then the new elements are placed into the array. If there are fewer elements than will fit in the array, then the remaining elements are initialized to zero-length strings (for String arrays) or Empty (for Variant arrays). A runtime error results if the array is too small to hold the new elements.



String containing the name of an ini file.


On return, the ArrayOfItems() parameter will contain one array element for each variable in the specified ini section.


Sub Main()
  Dim items() As String
  ReadIniSection "Windows",items$
  r% = SelectBox("INI Items",,items$)
End Sub

See Also

ReadIni$ (function); WriteIni (statement)


If the name of the ini file is not specified, then win.ini is assumed.

If the filename$ parameter does not include a path, then this statement looks for .ini files in the Windows directory.

More information