Results 1 to 4 of 4

Thread: Open a file

  1. #1

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Exclamation

    How can I open a file and insert its contents into a TextBox?

    thx, vbzero

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    'Open a file in binary mode and read into a textbox or string
    
        Dim sHolder As String
        Dim intNum As Integer
        Dim sFileName As String
        
        'open for binary and read
        sFileName = "C:\My Documents\MyFile.txt"
        intNum = FreeFile
        
        Open sFileName For Binary As intNum
          sHolder = Space(LOF(1))
          Get #1, , sHolder
        Close intNum
        
        'assign the text to a textbox
         Text1 = sHolder  ' for a string (strString = sholder)
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Thumbs up

    thx, vbzero

  4. #4
    Guest
    Code:
    Open "MyFile.txt" For Input As #1
    Text1 = Input(LOF(1),1)
    Close #1

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