Results 1 to 2 of 2

Thread: append line to beginning of a file...

  1. #1

    Thread Starter
    Lively Member Alessio's Avatar
    Join Date
    Feb 2002
    Location
    http://www.nottehorror.too.it
    Posts
    101

    append line to beginning of a file...

    as I let to append a line to the beginning of a file in which they are already there other lines ?
    ......:::::http://nottehorror.too.it/:::::......

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    This one needs one textbox & 1 command button ...
    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     Dim strCurrentFileText As String
    4.    
    5.     Open "C:\File.txt" For Input As #1
    6.         Do Until EOF(1)
    7.             strCurrentFileText = Input(LOF(1), 1)
    8.         Loop
    9.    Close #1
    10.    
    11.     Open "C:\File.txt" For Output As #1
    12.         strCurrentFileText = "Hello World" & vbCrLf & strCurrentFileText
    13.         Print #1, strCurrentFileText
    14.    Close #1
    15.    
    16.    MsgBox "File Written To!"
    17.    Unload Me
    18.    
    19. End Sub

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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