File Input Problems

patrickglass
05-07-2004, 08:14 PM
Hi i am loading playlist file information and am doing it by way of an m3u playlist file. i can save it out but to load from it does not seem to work i have tried to save it to a normal listbox but still does not work. any ideas are welcome. hope someone could give me a hint. thanks
ps i am using a listview.


Public Sub PlayerM3U(varOpen As Boolean, varPath As String)
On Error GoTo goClose
Dim varInp As String
Dim row As Integer
Dim subitem
Dim iFileID As Integer

If varOpen = True Then
iFileID = FreeFile
Open varPath For Input As #iFileID
Do Until EOF(iFileID) = True

Line Input #iFileID, varInp
If InStr("#", varInp) >= 0 Then GoTo GoNext
If varInp <> "" Then
Set subitem = Player.SongPlaylist.ListItems.Add(, , Left(varInp, Len(varInp) - 4))
subitem.SubItems(3) = Right(varInp, 4)
subitem.SubItems(2) = varInp
End If
GoNext:
Loop
Close #iFileID

Else ' this part of the code works fine
iFileID = FreeFile
Open App.Path & "\PlayerPlaylist.m3u" For Output As #iFileID
For row = 1 To Player.SongPlaylist.ListItems.Count
Print #iFileID, Player.SongPlaylist.ListItems.Item(row).SubItems(2)
Next
Close #iFileID
End If
goClose:
Close #iFileID
End Sub

webbone
05-07-2004, 09:56 PM
Your InStr() test when reading the file will only be True if the line is only a "#" - i.e. if varInp = "#". Is this really what you want to do? I'm guessing you just want to skip lines that contain '#' - if so you want this:


If InStr(varInp, "#") >= 0 Then GoTo GoNext

If this isn't your problem then what do you mean by "it still does not work" - can you be specific about what is wrong?

patrickglass
05-08-2004, 01:52 AM
hey thanks. well mu problem now is that it still will not get rid of the linesthat contain the "#" symbol. i am not sure what is going wrong. when i keep this line of code in i get no results and if i omit it it works fine except i get ever single line.



If InStr(varInp, "#") = true Or varInp <> "" Then GoTo GoNext


i have been playing around with my options and im unable to find any solution. thanks for the time. Pat

patrickglass
05-08-2004, 01:54 AM
hey thanks. well mu problem now is that it still will not get rid of the linesthat contain the "#" symbol. i am not sure what is going wrong. when i keep this line of code in i get no results and if i omit it it works fine except i get ever single line.



If InStr(varInp, "#") = true Or varInp <> "" Then GoTo GoNext


i have been playing around with my options and im unable to find any solution. thanks for the time. Pat

oh geez sorry but im my manipulating i had the <> instead of = in. my problem is now fixed thanks for the help and information.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum