3 Imports Microsoft
.VisualBasic
7 Sub f1(ByRef a
As Object)
10 Sub f2(ByVal array() As Object, ByVal index
As Integer, ByVal count
As Integer, ByVal value
As Object)
12 For i
= index
To (index
+ count
) - 1
19 On Error GoTo ErrorHandler
22 Dim b() As Object = New String(10) {}
24 f1(b(1)) ' ArrayTypeMismatchException
26 Dim str(100) As String
27 f2(str
, 0, 101, "Undefined")
28 f2(str
, 0, 10, Nothing)
29 f2(str
, 91, 10, 0) ' ArrayTypeMismatchException
33 If Err
.Number
<> 5 Then ' System.ArrayTypeMismatchException
34 Throw
New Exception("#CA1 - Conversion Statement failed")