Back to the boring stuff. Although this example is related to general programming and less towards automation, file handling is a major task that you will have to perform in automation. Therefore, we created this example to help you understand techniques of handling files. A lot has changed with VB.NET & C# and file handling so we recommend that you read this article first.
Several VB versions ago, you were suppose to stop using the old "file methods": Open, Close, Print, and Input statements. With VB6 you are suppose to use the Scripting File System Object.
To use the Scripting File System Object in your VB6 project you must include a reference to the object. Click on Project, References, and then click on Microsoft Scripting Runtime. You should already know that now you can click on View, Object Browser, and then select the Scripting library to see all of the objects, properties, events, and methods.
As with anything Microsoft develops there is more than one way to do file I/O in VB6. For selecting what file you want to work with Microsoft developed the common dialog boxes File Open and File Save. You can also do this using the Visual Basic controls Drive Listbox, Directory Listbox, and File Listbox. So we have included both techniques for you to evaluate.
In the VB6 example, we included only a few of the methods that the Scripting library contains. You should review the others to see what all it has to offer.
With .NET you are suppose to use the System.IO namespace. The Drive, Directory, and File listbox controls in VB6 are no longer available -- you are to use the File Open and File Save standard dialog boxes instead.
We try to offer a fair and balanced opinion on every page of our website. We would appreciate more information from other users to express their opinions which we will then incorporate. If you have questions or comments please post them on our message board (see button in left hand column) so that others can read and benefit.