by Niladrisekhar Dey (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 25th October 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Display file contents in a text box
'if put in a form then add a 'Private' keyword before function
'Pass the arguments sFileName as full path of a file and tBox as like Text1
Function GetFile(sFileName As String, tBox As TextBox) As Boolean
If Dir(sFileName, vbNormal) = "" Then
GetFile = False
Else
Dim sT As String
Open sFileName For Binary As #1
sT = Space(LOF(1))
Get #1, 1, sT
tBox.Text = sT
Close #1
GetFile = True
End If
End Function