Results 1 to 4 of 4

Thread: RESOLVED:How to write to text file continuously?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Resolved RESOLVED:How to write to text file continuously?

    Hi all . i am writing to text file the content of the textbox . I am using the following code but each time when i run my program the new data in textbox get inserted to text file but the old one get errased from text file!! Could any one tell me how i keep the old data in text file and write the new ones continously after the old ones.Thanks

    Code:
    Dim fn As Long
    Dim path As String
    Dim title As String
    
      fn = FreeFile
      Open "C:\albums.txt" For Output As #fn
        Write #fn, Text4.Text
      Close #fn
    Last edited by tony007; Apr 26th, 2006 at 02:22 PM.

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

    Re: How to write to text file continuously?

    Sure thing tony!

    Use this instead of the code you are using:
    VB Code:
    1. Dim fn As Long
    2. Dim path As String
    3. Dim title As String
    4.  
    5.   fn = FreeFile
    6.   Open "C:\albums.txt" For [b]Append[/b] As #fn
    7.     Write #fn, Text4.Text
    8.   Close #fn
    If I helped you please consider adding to my reputation!
    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
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to write to text file continuously?

    thank u for u reply. Is there a way not to write the " before each file in the text box. When i open the text file i see this :" before each block of data ? i do not know where it came from since it is not in the text box data!Thanks

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: How to write to text file continuously?

    Quote Originally Posted by tony007
    thank u for u reply. Is there a way not to write the " before each file in the text box. When i open the text file i see this :" before each block of data ? i do not know where it came from since it is not in the text box data!Thanks
    Yes. Use Print #fn instead of Write #fn

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