Hi

This code reads a txt file line by line
and adds it to a listbox, and it works,
but there is another thing I want i to
do. That is to NOT read empty lines.

Sometimes there are empty lines at the end
of txt files. Its easy to check by pressing
down arrow until thr cursor stops.
Is there some code to check for this and NOT
read it.

'My code

Private Sub mnuOpen_Click()

List1.Clear
Dim InputData

On Error GoTo mnuÅpneErr
CommonDialog1.Filter = "ASCII-tekst (*.txt)|*.txt"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
Do While Not EOF(1)
Line Input #1, InputData

InputData = Replace(InputData, "\", " - ")
InputData = Replace(InputData, "/", " - ")
InputData = Replace(InputData, ":", ".")
InputData = Replace(InputData, "*", "'")
InputData = Replace(InputData, "?", "")
InputData = Replace(InputData, Chr(34), "'")
InputData = Replace(InputData, "<", "'")
InputData = Replace(InputData, ">", "'")
InputData = Replace(InputData, "|", "")

If InputData = "" Then
KeyPress = Delete
End If

InputData = Trim$(InputData)
List1.AddItem InputData + ".mp3"

Loop
Close #1
Command1.Enabled = True

mnuÅpneErr:
Exit Sub
End Sub



Well, I hope you can help

Best Regards,

Chris Davidsen