PDA

Click to See Complete Forum and Search --> : opening and saving files using FSO


bas
Dec 8th, 1999, 01:53 AM
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.

Serge
Dec 8th, 1999, 02:02 AM
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)

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:

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 (http://www.icq.com/51055819)