CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: File Reading

  1. #1
    Join Date
    Jun 2001
    Posts
    4

    File Reading

    I have a file which has 10000 records.It is a tab delimited file.The file structure is as follows:Each record has 3 columns.The first column is a "FieldName" of length 50 characters,the second column is "Filenumber" of Integer type of length 2, the third is "Fieldnumber" of Integer of length 4.
    In my application the user enters a string and I need to search for the similar occurences of the string in the above mentioned file.I need to display all the records with similar occurences in a MSflexgrid.
    I am using VB 5.0 professional edition and can't use ADO.
    Please give me the VB syntax of doing this without compromising the performance


  2. #2
    Join Date
    May 2001
    Location
    Russia
    Posts
    200

    Re: File Reading

    Define user type

    Type YourRecord
    FieldName as string*50
    Filenumber as Integer
    Fieldnumber as Integer
    End Type



    Open file in Random access mode

    Dim f as Integer
    F = FreeFile
    Open "database.txt" for Random as f len=len(YourRecord)



    Get any record
    get #f, NumberRecord, YourRecord


    After this code in YourRecord you see record number NumberRecord

    Andy Tower

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

Featured