[SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][SIZE=2]Globals[/SIZE]
[SIZE=2] iniFile = "ini.ini"
[/SIZE][SIZE=2][COLOR=#0000ff] Dim [/COLOR][/SIZE][SIZE=2]iniData[/SIZE][SIZE=2][COLOR=#0000ff]
End Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][SIZE=2]App_Start
Form1.Show
[/SIZE][SIZE=2][COLOR=#0000ff] If FileExist[/COLOR][/SIZE][SIZE=2](iniFile) [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] FileOpen[/COLOR][/SIZE][SIZE=2](c1,iniFile,cRead)
iniData = [/SIZE][SIZE=2][COLOR=#0000ff]FileReadToEnd[/COLOR][/SIZE][SIZE=2](c1)
[/SIZE][SIZE=2][COLOR=#0000ff] FileClose[/COLOR][/SIZE][SIZE=2](c1)
[/SIZE][SIZE=2][COLOR=#0000ff] else
[/COLOR][/SIZE][SIZE=2][COLOR=#008000] 'create the ini file with the default values
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] end if
[/COLOR][/SIZE][SIZE=2] LoadCompleteSection("listbox items:","ListBox1")
[/SIZE][SIZE=2][COLOR=#0000ff]End Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]
'List can be an ArrayList, ComboBox or ListBox
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][SIZE=2]LoadCompleteSection(Section,List)
sectionData = GetSection(Section)
endS = [/SIZE][SIZE=2][COLOR=#0000ff]strLength[/COLOR][/SIZE][SIZE=2](sectionData)
[/SIZE][SIZE=2][COLOR=#0000ff] if [/COLOR][/SIZE][SIZE=2]endS = 0 [/SIZE][SIZE=2][COLOR=#0000ff]then return[/COLOR][/SIZE][SIZE=2][COLOR=#008000]'section was not found
[/COLOR][/SIZE][SIZE=2] i1 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](sectionData,crlf,0)
[/SIZE][SIZE=2][COLOR=#0000ff] Do While [/COLOR][/SIZE][SIZE=2]i1 < endS [/SIZE][SIZE=2][COLOR=#0000ff]AND [/COLOR][/SIZE][SIZE=2]i1 > -1
i3 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](sectionData,[/SIZE][SIZE=2][COLOR=#0000ff]chr[/COLOR][/SIZE][SIZE=2](34),i1) [/SIZE][SIZE=2][COLOR=#008000]'first quote
[/COLOR][/SIZE][SIZE=2] i4 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](sectionData,[/SIZE][SIZE=2][COLOR=#0000ff]chr[/COLOR][/SIZE][SIZE=2](34),i3+1) [/SIZE][SIZE=2][COLOR=#008000]'second quote
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] if [/COLOR][/SIZE][SIZE=2]i3 > 0 [/SIZE][SIZE=2][COLOR=#0000ff]AND [/COLOR][/SIZE][SIZE=2]i4>0 [/SIZE][SIZE=2][COLOR=#0000ff]then Control[/COLOR][/SIZE][SIZE=2](List).Add([/SIZE][SIZE=2][COLOR=#0000ff]SubString[/COLOR][/SIZE][SIZE=2](sectionData,i3+1,i4-i3-1))
i1 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](sectionData,crlf,i1+1)
[/SIZE][SIZE=2][COLOR=#0000ff] Loop
End Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]
Sub [/COLOR][/SIZE][SIZE=2]GetSection(Section)
i1 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](iniData,"[" & Section & "]",0) [/SIZE][SIZE=2][COLOR=#008000]'section start
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] if [/COLOR][/SIZE][SIZE=2]i1 = -1 [/SIZE][SIZE=2][COLOR=#0000ff]then return
[/COLOR][/SIZE][SIZE=2] i2 = [/SIZE][SIZE=2][COLOR=#0000ff]StrIndexOf[/COLOR][/SIZE][SIZE=2](iniData,crlf & "[",i1+1) [/SIZE][SIZE=2][COLOR=#008000]'end of section
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] if [/COLOR][/SIZE][SIZE=2]i2 = -1 [/SIZE][SIZE=2][COLOR=#0000ff]then [/COLOR][/SIZE][SIZE=2]i2 = [/SIZE][SIZE=2][COLOR=#0000ff]StrLength[/COLOR][/SIZE][SIZE=2](iniData) [/SIZE][SIZE=2][COLOR=#008000]'This is the last section
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff] return SubString[/COLOR][/SIZE][SIZE=2](iniData,i1,i2-i1) [/SIZE][SIZE=2][COLOR=#008000]'It is better to work with the relevant section if the file is large.
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]End Sub
[/COLOR][/SIZE]