VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Easy way to reading any flat/text file it take only few line of code

by Nimesh Surana (2 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 19th February 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Easy way to reading any flat/text file it take only few line of code

API Declarations


Dim MailContents As String
Dim filecontents
Dim datafile$
Dim NextAvailFreefile%
Dim ctr


Rate Easy way to reading any flat/text file it take only few line of code




'****************************************
'Declareing the Variables
'****************************************
    Dim temp
    Dim MailContents As String
    Dim filecontents
    Dim datafile$
    Dim NextAvailFreefile%
    Dim ctr

'***************************************** 
    
   filepath = App.Path 'assign the File Path

    
    NextAvailFreefile = 0 'Setting the variable

    NextAvailFreefile = FreeFile
    
    datafile = filepath 'assigning the file name to a variable


    Open datafile For Input As #NextAvailFreefile 'opening the File


     Do While Not EOF(NextAvailFreefile)
    
         DoEvents
        
        
         Line Input #NextAvailFreefile, filecontents
        
                
            temp = Trim(Left(filecontents, 3)) 'Reading the file contants
   
Loop
   
Close NextAvailFreefile

End Sub


Download this snippet    Add to My Saved Code

Easy way to reading any flat/text file it take only few line of code Comments

No comments have been posted about Easy way to reading any flat/text file it take only few line of code. Why not be the first to post a comment about Easy way to reading any flat/text file it take only few line of code.

Post your comment

Subject:
Message:
0/1000 characters