Results 1 to 5 of 5

Thread: Opening File

  1. #1

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    I can't figure out what is wrong with this. It just doesn't print the results that I want:
    Here's the text file:
    "Mike";
    1;
    2;
    3;
    4;

    Code:
    Option Explicit
    Global StudentGrades() As StudentRecord
    
    Type StudentRecord
        Name As String
        FirstExam As Integer
        SecondExam As Integer
        ThirdExam As Integer
        FourthExam As Integer
    End Type
    
    
    Sub RetrieveGrade()
        
        Dim FileNum As Integer
        Dim I As Integer
        ReDim StudentGrades(1)
        FileNum = FreeFile
        
        Open "c:\Grades.txt" For Input As FileNum
            Input #FileNum, StudentGrades(I).Name
            Input #FileNum, StudentGrades(I).FirstExam
            Input #FileNum, StudentGrades(I).SecondExam
            Input #FileNum, StudentGrades(I).ThirdExam
            Input #FileNum, StudentGrades(I).FourthExam
        Close FileNum
                    
    End Sub

    Code:
    Private Sub Command1_Click()
        Dim I As Integer
        Call RetrieveGrade
        
        
            Print StudentGrades(I).Name
            Print StudentGrades(I).FirstExam
            Print StudentGrades(I).SecondExam
            Print StudentGrades(I).ThirdExam
            Print StudentGrades(I).FourthExam
    End Sub
    [Edited by Lethal on 01-09-2001 at 11:07 PM]

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    what are you getting?
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    I'm getting the name on the first line, then a whole bunch of zero's after it.

  4. #4

    Thread Starter
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Figured it out, dumb mistake.

  5. #5
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    uh, well, glad to be of help
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

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