18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />

The Err object's properties are reset to zero or zero-length strings ("") after an On Error<br />

Resume Next statement. The Clear method can be used to explicitly reset Err.<br />

For more in<strong>for</strong>mation, see Microsoft <strong>Web</strong> site. 3<br />

Property Description<br />

Function: Returns or sets a descriptive string associated with an error.<br />

Usage: Err.Description [= stringexpression]<br />

Arguments stringexpression<br />

A string expression containing a description of the error.<br />

Remarks: The Description property consists of a short description of the error. Use this<br />

property to alert the user to an error that you can't or don't want to handle. When<br />

generating a user-defined error, assign a short description of your error to this<br />

property. If Description isn't filled in, and the value of Number corresponds to a<br />

<strong>VBScript</strong> run-time error, the descriptive string associated with the error is<br />

returned<br />

Example: On Error Resume Next<br />

Error.Raise 39 ‘This is a non-defined <strong>VBScript</strong> error<br />

Err.Description =”Pump OverFlow” ‘Define the error message<br />

MsgBox “Error type is “ & Err.Description<br />

Property HelpContext<br />

Function: Sets or returns a context ID <strong>for</strong> a topic in a Help File.<br />

Usage: Err.HelpContext [= contextID]<br />

Arguments contextID<br />

Optional. A valid identifier <strong>for</strong> a Help topic within the Help file.<br />

Remarks: If a Help file is specified in HelpFile, the HelpContext property is used to<br />

automatically display the Help topic identified. If both HelpFile and HelpContext<br />

are empty, the value of the Number property is checked. If it corresponds to a<br />

<strong>VBScript</strong> run-time error value, then the <strong>VBScript</strong> Help context ID <strong>for</strong> the error is<br />

used. If the Number property doesn't correspond to a <strong>VBScript</strong> error, the<br />

contents screen <strong>for</strong> the <strong>VBScript</strong> Help file is displayed.<br />

Example: On Error Resume Next<br />

Const usercontextID = 10<br />

Error.Raise 48 ‘Error Loading DLL<br />

Err.HelpFile = “myDLL.hlp” ‘The help file<br />

Err.HelpContext = usercontextID ‘Specify the user context ID<br />

If Err.Number 0 Then<br />

MsgBox “Press F1 <strong>for</strong> help ” & “Error:” & Error.Description &_<br />

Err.Helpfile & Err.HelpContext<br />

End If<br />

3 http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/shop1205.mspx<br />

http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/shop0106.mspx<br />

<strong>InduSoft</strong>, Ltd. 199

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!