Results 1 to 5 of 5

Thread: Edit text file in vb 6.0

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Edit text file in vb 6.0

    Hi all I want to open a text file to put in it one string and after that to close it. Can you give me some code examples.
    Thanks in advance
    Bezbojnika

  2. #2
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Edit text file in vb 6.0

    Hey man. You can use this:
    VB Code:
    1. Open App.Path & "\Test.txt" For Append As #1
    2. Print #1, "I am inputting this string"
    3. Close #1
    Hope this helps!
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Re: Edit text file in vb 6.0

    Yes that was great for me,
    i have only one question how to clear all content of the text file before insert the string.
    i wan it to be empty.

    Thanks.

  4. #4
    Member
    Join Date
    Mar 2006
    Posts
    39

    Re: Edit text file in vb 6.0

    If you want to overwrite the text file, use Output instead of Append in the Open statement.

  5. #5
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Edit text file in vb 6.0

    As kberry79 said, just use this:
    VB Code:
    1. Open App.Path & "\Test.txt" For Output As #1
    2. Print #1, "I am inputting this string into an empty file"
    3. Close #1
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

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