CasewareDocs

Add

Adds a new error at the end of the list.

Compatibility

Available as of IDEA version 9.1.1

Syntax

Add(Number As Integer, description As String, source As String)

Parameters

Number

The error number

Description

The error description. Can be null.

Source

The error source. Can be null.

Example

Option Explicit
'Errors, IError, IErrors

Sub Main()

'IErrors - errorlist
Dim errorlist As Variant

'Errors
Set errorlist = SmartContext.Errors

Dim txt As String
txt = "Errors:" + Chr(13)

'IError - oneerror
Dim oneerror As Object
For Each oneerror In errorlist
'Examples for the methods of interface IError
txt = txt + Str(oneerror.Number) + ", " + oneerror.Description + ", " + oneerror.Source + Chr(13)
Next
MsgBox txt

'Examples for the methods of interface IErrors (Add,Clear,Count, Item)

'Add - Adds a new error at the end of the list. (errorno as integer, errordesc as string, errorSource as string )

errorlist.Add 12, "errorDesc", "errorSource"

'Count - Gets the number of elements in the collection.
Dim numberofelements As Long
numberofelements = errorlist.Count

'Item - Gets the value at the specified position.
Dim lasterror As Object
Set lasterror = errorlist.Item(numberofelements - 1)

'Clear - Removes all values from the list.
errorlist.Clear
End Sub