Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > File Input Problems


Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2004, 08:14 PM
patrickglass patrickglass is offline
Newcomer
 
Join Date: Feb 2004
Location: Vancouver Island, Canada
Posts: 21
Default File Input Problems


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.

Code:
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
Reply With Quote
  #2  
Old 05-07-2004, 09:56 PM
webbone's Avatar
webbone webbone is offline
Hydrogen Powered

Administrator
* Expert *
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 6,090
Default

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:

Code:
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?
__________________
"With the appearance of the AddressOf operator, an entire industry has developed among authors illustrating how to do previously impossible tasks using Visual Basic. Another industry is rapidly developing among consultants helping users who have gotten into trouble attempting these tasks." -Dan Appleman
Reply With Quote
  #3  
Old 05-08-2004, 01:52 AM
patrickglass patrickglass is offline
Newcomer
 
Join Date: Feb 2004
Location: Vancouver Island, Canada
Posts: 21
Default

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.

Code:
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
Reply With Quote
  #4  
Old 05-08-2004, 01:54 AM
patrickglass patrickglass is offline
Newcomer
 
Join Date: Feb 2004
Location: Vancouver Island, Canada
Posts: 21
Default

Quote:
Originally Posted by patrickglass
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.

Code:
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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File I/O GavinO Tutors' Corner 5 04-17-2013 01:18 PM
how to input .CSV database file into VB, by only input the selected area jackie_chen1121 Database and Reporting 1 04-16-2004 06:55 AM
Makin a nice little program! Decontain Communications 3 04-11-2003 02:54 AM
Querying text file before Input MKoslof Database and Reporting 4 04-01-2003 07:49 AM
Doesn't want to register! MikeyM Installation / Documentation 5 03-02-2003 08:22 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->