Results 1 to 17 of 17

Thread: Opening a file to display text?

Threaded View

  1. #12
    Fanatic Member proneal's Avatar
    Join Date
    May 2011
    Posts
    762

    Re: Opening a file to display text?

    You would have to modify your Open code.
    Something like this
    vb Code:
    1. Sub DisplayGrades(ByVal gradesFiles As GradesFiles)
    2.         Dim fileReader As StreamReader = Nothing
    3.  
    4.         fileReader = New StreamReader(FileName)
    5.         Dim Grades As Integer = 0
    6.         Do While Not fileReader.EndOfStream
    7.             Dim line As String = fileReader.ReadLine()
    8.  
    9.             Grades = +1
    10.             If displayif(Grades, gradesFiles) Then
    11.                 gradesListBox.Items.Add(line)
    12.             End If
    13.         Loop
    14.         fileReader.Close()
    15.         fileReader = Nothing
    16.  
    17.     End Sub

    The way you had it before never iterated through the text file line by line-
    -
    It's how we learn

    edit: I dont think displayif is needed at all. Not sure why it's there.

    Good Luck!
    Last edited by proneal; Feb 9th, 2012 at 10:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width