VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Open a file and load its text. Very simple and short code. I always use this code for my applicatio

by Choosing Corporation (4 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 12th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Open a file and load its text. Very simple and short code. I always use this code for my applications.

Rate Open a file and load its text. Very simple and short code. I always use this code for my applicatio



' By Choosing Corp. [http://www.choosingcorp.net]
' E-Mail: [email protected]
On Error GoTo msgError
Dim RowLine As Integer, RowValue As String, NewLine As String
NewLine = Chr$(13) & Chr$(10)
RowLine = 0
OpenFile = Empty
If Dir(flFileName, vbNormal) = "" Then
MsgBox msgMessageError, msgStyleError, msgTitleError
Exit Function
End If
Open flFileName For Input As #FileNumber
For RowLine = 0 To LOF(FileNumber)
Line Input #FileNumber, RowValue
If EOF(FileNumber) Then
OpenFile = OpenFile & RowValue
Exit For
Exit Function
End If
OpenFile = OpenFile & RowValue & NewLine
Next RowLine
Close #FileNumber
Exit Function
msgError:
MsgBox "Si è verificato un errore durante l'apertura del file """ & flFileName & """.", vbExclamation + vbOKOnly, "Errore"
End Function

Download this snippet    Add to My Saved Code

Open a file and load its text. Very simple and short code. I always use this code for my applicatio Comments

No comments have been posted about Open a file and load its text. Very simple and short code. I always use this code for my applicatio. Why not be the first to post a comment about Open a file and load its text. Very simple and short code. I always use this code for my applicatio.

Post your comment

Subject:
Message:
0/1000 characters