Results 1 to 7 of 7

Thread: Can you.... * RESOLVED *

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    UK
    Posts
    83

    Can you.... * RESOLVED *

    Can you..

    load the contents of a .txt file into a normal text box? IE. NOT a rich text box. Just the normal one or does it have to a a rtb? If you can do it with a normal text box please reply with how.
    Last edited by DanC2k2; Nov 3rd, 2002 at 07:10 PM.

  2. #2
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    259
    You can load it into the text box, just not the formatting...

    VB Code:
    1. Private Sub Form_Load()
    2. Dim CurrentLine As String
    3. Open App.Path & "\FILENAME.txt" For Input As #1
    4.     Do Until EOF(1)
    5.         Line Input #1, CurrentLine
    6.         text1.Text = text1.Text & vbNewLine & CurrentLine
    7.     Loop
    8. Close #1
    9. End Sub

    make a text box (text1) and make sure it is mulitline.
    SonicMailer Pro
    The best mailing list manager has just gotten better!
    Click here for a full list of features!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    UK
    Posts
    83
    Thankyou!!

  4. #4
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Here's another method.

    Code:
    Open "Myfile" for Input As #1
    Text1.Text = Input(LOF(1),1)
    Close #1

  5. #5
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    259
    Megatron's works as well, however, I think my way is better for experience, as it gives you the basic method of how to read a file and actually use it in various ways...
    SonicMailer Pro
    The best mailing list manager has just gotten better!
    Click here for a full list of features!

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2002
    Location
    UK
    Posts
    83
    now now, no need to fight over helping me

  7. #7
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Originally posted by kandieman101
    Megatron's works as well, however, I think my way is better for experience, as it gives you the basic method of how to read a file and actually use it in various ways...
    I use Megatron's method.

    Well, the method he stated, I used it before he said it here....

    Yeah....

    Only one thing. I open for binary. It's faster.


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