ErrObject.Number Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns or sets a numeric value specifying an error. Read/write.
Namespace: Microsoft.VisualBasic
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Syntax
'Declaration
Public Property Number As Integer
public int Number { get; set; }
Property Value
Type: System.Int32
Returns or sets a numeric value specifying an error. Read/write.
Remarks
When returning a user-defined error from an object, set Err.Number by adding the number you selected as an error code to the VbObjectError constant. For example, you use the following code to return the number 1051 as an error code:
Err.Raise(Number:=vbObjectError + 1051)
Examples
This example illustrates a typical use of the Number property in an error-handling routine.
' Typical use of Number property.
Sub test()
On Error GoTo out
Dim x, y As Integer
x = 1 / y ' Create division by zero error.
Exit Sub
out:
Dim Msg = Err.Number & " " & Err.Description
' Check for division by zero error.
If Err.Number = 11 Then
y = y + 1
End If
Resume Next
End Sub
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.