gvsbnarayana
asked on
How to Write to a File
Can anyone explain me how to write to a file? I want to ask the user to give a file name and I need to write some data to the File. How to do this and what are the controls and/or components to be added to the project?
Thanks and Regards,
Badri
Thanks and Regards,
Badri
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dear kprestage ,
I could not find that component name in my system and the component might be displayed with some other name as the names of the components will be displayed in French as my Operating system is a French version. So Can you give me the name of the dll ?
Thanks and Regards,
Badri
I could not find that component name in my system and the component might be displayed with some other name as the names of the components will be displayed in French as my Operating system is a French version. So Can you give me the name of the dll ?
Thanks and Regards,
Badri
> The easiest and fastest way to do this is using the Microsoft Scripting host
actually, fso has more overhead than the native vb file i/o methods... therefore it is actually slower. In addition, you need the scrrun.dll (i think that's the one) included w/ your package. So for simple file i/o (ie. simply reading/writing to a file) i would strongly suggest just using the native routines as shown by TimCottee above.
actually, fso has more overhead than the native vb file i/o methods... therefore it is actually slower. In addition, you need the scrrun.dll (i think that's the one) included w/ your package. So for simple file i/o (ie. simply reading/writing to a file) i would strongly suggest just using the native routines as shown by TimCottee above.
As bobbit31 said, the file name for the dll is scrrun.dll. It was my understanding that the native VB file I/O commands were being depreciated in VB.net, meaning, don't get accustomed to using them because they may not always be around.
gvsbnarayana,
'Microsoft Scripting Runtime' is not found in components, it is found as a reference.
'Microsoft Scripting Runtime' is not found in components, it is found as a reference.
ASKER
Thank you TimCottee
Here are your points!!
Here are your points!!
dim fso as new filesystemobject
dim ts as TextStream
use the createtextfile method to create your file based on the path you want
set ts = fso.CreateTextFile(filenam
to write to your file use the write, or writeline method of the textstream
ts.write "Text you want to write to the file"