Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004

    Unanswered: Pulling data from a text file???

    Hi everyone,
    I have a text file saved in the Bin-folder. It has several lines of comma-delimited record: ID, Lastname, Firstname, Grade.
    ID as integer, LAstname/Firstname as strings and grade as double.
    I want my form to pull those data up and insert the four items into four arrays.
    The file should be read one line at a time until the end. After the file is read it should display the four arrays created into four columns.

    Any ideas?!?! I have no clue... :-(
    Please help!

  2. #2
    Join Date
    Feb 2004

    Dont have time to describe it properly, but:
    1. you need to create a type in a module and dimensionalise this type as an array (having four arrays for 1 record is a bad idea).
    2. You need to get the path where the file is from the user (I prefer to use the commondialog control for this (in components select Microsoft Common Dialog Control 6.0).
    3. You need to use the freefile command (intfilehandle = freefile).
    4. You need to use the open command (open {filename} for input as #intfilehandle).
    5. In a loop (do while not EOF(intfilehandle)), use line input to get the data (line input #intfilehandle, strinput)
    6. In the loop you need to parse the input and return it to the type array.
    7. In the loop you need to validate the input
    8. After the loop you need to close the file (close #intfilehandle)
    9. Display the results from the type as you see fit.

    If you still have trouble, send me an e-mail at (subject it something like, can you help with VB as I get a lot of junk mail) and I might be able to send you some old code for steps 1 -8 (step 9 is up to you, though I would recommend reasearching how to use the flexgrid or datagrid controls).


Posting Permissions

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