Results 1 to 6 of 6

Thread: Displaying Files in a Text Box

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2000
    Location
    Galloway, OH, US
    Posts
    13

    Post

    I am new to VB and having a hard time displaying a file in a text box. I have figured out the code to get the file to open but haven't been able to write the code so that a report will display in the text box instead of just the file name. Can anyone help?

    ------------------
    M Gifford

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Location
    Burlington, IA, USA`
    Posts
    77

    Post

    an easy way is to use a RichTextBox

    RichTextBox1.LoadFile pth

    pth is a variable for Path and FileName

  3. #3
    Junior Member
    Join Date
    Jan 2000
    Posts
    21

    Post

    You can use the following code:

    FileName$ = "c:\test.txt"
    Open FileName$ For Input As #1
    Text1.Text = Input(LOF(1), 1)
    Close

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Quick question, what is the LOF?

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    LOF = Length Of File

    ------------------
    Joacim Andersson
    [email protected]
    [email protected]
    www.YellowBlazer.com



  6. #6
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    Ah, thanks. I guess if I would have thought a little harder I might have figured that one out. Ah well, what can I say, it's early Thursday morning and I'm still asleep. Honest, that's the reason :-)

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