The "OpenTextFile" Visual Basic function opens a file and reads the data that you can use to calculate output for your readers. An SCH file is a Microsoft Schedule file. The OpenTextFile function imports the data without the formatting codes. You can import the scheduling data using the VB OpenTextFile, which is included with the Visual Basic input and output libraries.
Instructions
- 1Open the Visual Studio VB programming software on your desktop. Open the project file and the source code file you want to use to open the SCH file.
- 2Create a file handler variable for the file class. Add the following code to create the variable:var handler = new ActiveXObject("Scripting.FileSystemObject");
- 3Open the SCH file using the "handler" variable. The following code uses the OpenTextFile function to open the file named "myfile.sch":file = handler.OpenTextFile("c:\myfile.sch", ForReading);
- 4Read the file content. For instance, the following code reads the first line of the file and outputs the result to the user's screen:var input = file.ReadLine();
document.write (input + "<br />");
- 1