From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../source/text/sbasic/shared/03050500.xhp | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/03050500.xhp (limited to 'helpcontent2/source/text/sbasic/shared/03050500.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/03050500.xhp b/helpcontent2/source/text/sbasic/shared/03050500.xhp new file mode 100644 index 000000000..3d1e71c39 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03050500.xhp @@ -0,0 +1,86 @@ + + + + + + + On Error GoTo ... Resume Statement + /text/sbasic/shared/03050500.xhp + + + + +
+ + Resume Next parameter + On Error GoTo ... Resume statement + +On Error GoTo ... Resume Statement +Enables an error-handling routine after an error occurs, or resumes program execution. +
+ + + + On Error Statement diagram + + +On [Local] Error {GoTo Labelname | GoTo 0 | Resume Next} + + + +GoTo Labelname: If an error occurs, enables the error-handling routine that starts at the line "Labelname". +Resume Next: If an error occurs, program execution continues with the statement that follows the statement in which the error occurred. +GoTo 0: Disables the error handler in the current procedure. +Local: "On error" is global in scope, and remains active until canceled by another "On error" statement. "On Local error" is local to the routine which invokes it. Local error handling overrides any previous global setting. When the invoking routine exits, the local error handling is canceled automatically, and any previous global setting is restored. +The On Error GoTo statement is used to react to errors that occur in a macro.see i112231: The statement must be inserted at the start of a procedure (in a local error-handling routine) or at the start of a module. + + + +Sub ExampleReset +On Error GoTo ErrorHandler + Dim iNumber As Integer + Dim iCount As Integer + Dim sLine As String + Dim aFile As String + aFile = "C:\Users\ThisUser\data.txt" + iNumber = Freefile + Open aFile For Output As #iNumber + Print #iNumber, "This is a line of text" + Close #iNumber + iNumber = Freefile + Open aFile For Input As iNumber + For iCount = 1 To 5 + Line Input #iNumber, sLine + If sLine <>"" Then + Rem + End If + Next iCount + Close #iNumber + Exit Sub +ErrorHandler: + Reset + MsgBox "All files will be closed", 0, "Error" +End Sub + +
+ + +
+ +
-- cgit v1.2.3