home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="utf-8"?> <html><head><title>Error Function [Runtime]</title><meta name="filename" content="text/sbasic/common/03050300"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css"> p.P1{ } span.T1{ font-weight:bold;} </style></head><body> <help:to-be-embedded Eid="errorf" xmlns:help="http://openoffice.org/2000/help"> <p class="Head1"><help:link Id="66536">Error Function [Runtime]</help:link></p> <p class="Paragraph">Returns the error message corresponding to a given error code.</p> </help:to-be-embedded> <p class="Paragraph"><span class="T1">Syntax</span>:</p> <p class="Paragraph">Error (Expression) <help:key-word value="Error" tag="kw66536_1" xmlns:help="http://openoffice.org/2000/help"/></p> <p class="Paragraph"><span class="T1">Return value</span>:</p> <p class="Paragraph">String</p> <p class="Paragraph"><span class="T1">Parameter</span>:</p> <p class="Paragraph">Expression: Any numeric expression that contains the error code of the error message to be returned.</p> <p class="Paragraph">If no parameters are passed, the Error function returns the error message of the most recent error that occured during program execution.</p> <p class="Paragraph"><span class="T1">Example:</span></p> <p class="PropText">sub ExampleError</p> <p class="PropText">on error goto ErrorHandler REM Set up error handler</p> <p class="PropText">Dim iVar as Integer</p> <p class="PropText">Dim sVar As String</p> <p class="PropText">REM An error occurs due to non-existent file</p> <p class="PropText">iVar = Freefile</p> <p class="PropText">Open "\file9879.txt" for Input as #iVar</p> <p class="PropText">Line Input #iVar, sVar</p> <p class="PropText">Close #iVar</p> <p class="PropText">exit sub</p> <p class="PropText">ErrorHandler:</p> <p class="PropText">MsgBox "Error " & err & ": " & error$ + chr(13) + "In line : " + Erl + chr(13) + Now , 16 ,"error occurred"</p> <p class="PropText">end sub</p> <p class="PropText"/> </body></html>