66 lines
No EOL
3.7 KiB
XML
66 lines
No EOL
3.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
-->
|
|
|
|
<helpdocument version="1.0">
|
|
<meta>
|
|
<topic id="textsbasicshared03050200xml" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">Err Function</title>
|
|
<filename>/text/sbasic/shared/03050200.xhp</filename>
|
|
</topic>
|
|
<history>
|
|
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
|
|
</history>
|
|
</meta>
|
|
<body>
|
|
<section id="err">
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id3156343"><bookmark_value>Err function</bookmark_value>
|
|
</bookmark>
|
|
<h1 id="hd_id3156343"><link href="text/sbasic/shared/03050200.xhp">Err Function</link></h1>
|
|
<paragraph role="paragraph" id="par_id3150541" xml-lang="en-US">Returns an error code that identifies the error that occurred during program execution.</paragraph>
|
|
</section>
|
|
<h2 id="hd_id3149656">Syntax:</h2>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="par_id3154123" xml-lang="en-US">Err</paragraph>
|
|
</bascode>
|
|
<h2 id="hd_id3147229">Return value:</h2>
|
|
<paragraph role="paragraph" id="par_id3150869" xml-lang="en-US">Integer</paragraph>
|
|
<h2 id="hd_id3153193">Parameters:</h2>
|
|
<paragraph role="paragraph" id="par_id3149561" xml-lang="en-US">The Err function is used in error-handling routines to determine the error and the corrective action.</paragraph>
|
|
<h2 id="hd_id3147317">Example:</h2>
|
|
<bascode>
|
|
<paragraph role="bascode" id="par_id3153727" xml-lang="en-US" localize="false">Sub ExampleError</paragraph>
|
|
<paragraph role="bascode" id="par_id3147426" xml-lang="en-US">On Error Goto ErrorHandler REM Set up error handler</paragraph>
|
|
<paragraph role="bascode" id="par_id3163710" xml-lang="en-US" localize="false">Dim iVar as Integer</paragraph>
|
|
<paragraph role="bascode" id="par_id3153093" xml-lang="en-US" localize="false">Dim sVar As String</paragraph>
|
|
<paragraph role="bascode" id="par_id3149481" xml-lang="en-US">REM Error occurs due to non-existent file</paragraph>
|
|
<paragraph role="bascode" id="par_id3153190" xml-lang="en-US" localize="false"> iVar = Freefile</paragraph>
|
|
<paragraph role="bascode" id="par_id3146120" xml-lang="en-US" localize="false"> Open "\file9879.txt" for Input as #iVar</paragraph>
|
|
<paragraph role="bascode" id="par_id3155308" xml-lang="en-US" localize="false"> Line Input #iVar, sVar</paragraph>
|
|
<paragraph role="bascode" id="par_id3153142" xml-lang="en-US" localize="false"> Close #iVar</paragraph>
|
|
<paragraph role="bascode" id="par_id3149665" xml-lang="en-US" localize="false">Exit Sub</paragraph>
|
|
<paragraph role="bascode" id="par_id3154942" xml-lang="en-US" localize="false">ErrorHandler:</paragraph>
|
|
<paragraph role="bascode" id="par_id3145646" xml-lang="en-US"> MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred"</paragraph>
|
|
<paragraph role="bascode" id="par_id3155418" xml-lang="en-US" localize="false">End Sub</paragraph>
|
|
</bascode>
|
|
<section id="relatedtopics">
|
|
<embed href="text/sbasic/shared/03050000.xhp#ErrHandlingh1"/>
|
|
</section>
|
|
</body>
|
|
</helpdocument> |