Results 1 to 2 of 2

Thread: opening and saving files using FSO

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Posts
    3

    Post

    Hi!
    I was wondering if any one can tell
    me how I can open & save files from a floppy
    using filesystemobject or otherwise.
    The pgm calls for saving each line in a listbox and opening it again to demonstrate opening and saving files.I have a hard time understanding that chapter.I have the program
    setup where a user can click on the OPEN or SAVE button and a new form loads with 3 controls 1)drive control 2)dir control 3)file control. After this point everything else is greek to me
    THANKS .
    THANKS.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    First add a reference to Microsoft Scripting Runtime Library.

    To open file and show it in a textbox (don't forget to set the MultiLine property to True)
    Code:
        Dim oFSO As New FileSystemObject
        Dim oFile As Object
        
        Set oFile = oFSO.OpenTextFile("F:\Test.txt", ForReading, False, TristateUseDefault)
        Text1.Text = oFile.ReadAll
    To save the contents of the textbox to a file:
    Code:
        Dim oFSO As New FileSystemObject
        Dim oFile As Object
        
        Set oFile = oFSO.OpenTextFile("F:\Test2.txt", ForWriting, TristateUseDefault)
        oFile.Write Text1.Text
    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


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