VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Display file contents in a text box

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

Rate 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

Download this snippet    Add to My Saved Code

Display file contents in a text box Comments

No comments have been posted about Display file contents in a text box. Why not be the first to post a comment about Display file contents in a text box.

Post your comment

Subject:
Message:
0/1000 characters