Siebel VB Language Reference > VB Language Reference >
Reset Statement
This standard VB statement closes every open disk file and writes to disk any data in the operating system buffers. Syntax
Reset
Returns
Not applicable Example
This example creates a file, puts the numbers 1 through 10 in it, and then attempts to get past the end of the file. The On Error statement traps the error, and execution goes to the Debugger code, which uses Reset to close the file before exiting. Sub Button_Click ' Put the numbers 1-10 into a file Dim x as Integer Dim y as Integer On Error Goto Debugger Open "c:\temp001" as #1 Len = 2 For x = 1 to 10 Put #1,x, x Next x Close #1 msgtext = "The contents of the file is:" & Chr(10) Open "C:\TEMP001" as #1 Len = 2 For x = 1 to 10 Get #1,x, y msgtext = msgtext & Chr(10) & y Next x done: Close #1 Kill "c:\temp001" Exit Sub
Debugger: TheApplication.RaiseErrorText "Error " & Err & " occurred. Closing open file." Reset Resume done End Sub
Related Topics
Close Statement
|