Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Vb.net - Making a program read a file and ouputting the line
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
supaphreek




PostPosted: Thu Dec 09, 2010 6:24 pm   Post subject: Vb.net - Making a program read a file and ouputting the line

So basically, i have a program that reads a textfile. If the line its reading contains a word ive specified, it will output that entire line into a second file. My problem is, when im executing it to find the number of artists(<key>Artist<key>), it always stops at the 670th line and cuts off.
eg 669th line : <key>Artist<key><string>Linkin Park</string>
670th line : <key>Artist<key><string>Linkin Park</

So, i would like to know how to fix this problem. When i use it to find the name, it works perfectly and gives me all 690 of them however it doesnt work with artist.

Thanks! my code is as follows.

VB:
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim FILE_NAME As String = "C:\Users\Sri\Desktop\OutputLibrary.txt"
        Dim TextLine As String = ""
        Dim File_Out As String = "C:\Users\Sri\Desktop\libartist.txt"

        If System.IO.File.Exists(FILE_NAME) = True Then

            Dim objReader As New System.IO.StreamReader(FILE_NAME)
            Dim objWriter As New System.IO.StreamWriter(File_Out)

            Do While objReader.Peek() <> -1
                TextLine = objReader.ReadLine() & vbNewLine

                'If TextLine.Contains("<key>Name</key>") Then
                'objWriter.Write(TextLine)
                'End If
                If TextLine.Contains("<key>Artist</key>") Then
                    objWriter.Write(TextLine)
                End If
                'If TextLine.Contains("<key>Album</key>") Then
                'objWriter.Write(TextLine)
                'End If
                'If TextLine.Contains("<key>Genre</key>") Then
                'objWriter.WriteLine(TextLine)
                'End If
            Loop


        Else

            MsgBox("File Does Not Exist")

        End If
    End Sub
End Class
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: