exception_object.Clone Method

Method that returns a copy of the exception_object.

...exception_object.Clone

Prerequisites

None

Parameters

None

Remarks

For objects, if a program contains a simple assignment statement:

object_1 = object_2

the result is that object_1points to the same data as object_2. Any subsequent change of a property in either object_1 or object_2 affects the data associated with both objects.

If you wish to make an independent copy of an object, the Clone method is the standard means for performing this operation:

object_1 = object_2.Clone

Examples

Dim exc1 As New Exception       ' Create new exception with data
Dim exc2 As Exception ' Create new exception with no data
exc1.ErrorCode = -1002 ' *Invalid axis* error code
exc1.RobotError = True
exc2 = exc1.Clone ' Makes a copy of exc1 data
exc2.Axis = &HC ' Does not affect exc1 data
Console.WriteLine(exc1.Message) ' *Invalid axis* Robot 1
Console.WriteLine(exc2.Message) ' *Invalid axis* Robot 1: 3 4

See Also

Exception Handling