Private Sub cmdRead_Click()
Dim fnum As Integer
Dim one_line As String
Dim pos As Integer
fnum = FreeFile
Open txtFileName.Text For Input As fnum
Do While Not EOF(fnum)
' Read a line.
Line Input #fnum, one_line
' See what it is.
If Left$(one_line, 1) = "[" Then
' Section heading.
lstValues.AddItem "Section: " & _
Mid$(one_line, 2, Len(one_line) - 2)
ElseIf InStr(one_line, "=") > 0 Then
pos = InStr(one_line, "=")
lstValues.AddItem " " & _
Left$(one_line, pos - 1) & _
" (" & _
Mid$(one_line, pos + 1) & _
")"
Else
lstValues.AddItem " " & one_line
End If
Loop
Close fnum
End Sub
|