Article ID: 193367
Article Last Modified on 3/18/2005
Public Function UseArray(ByRef vArray As Variant) As Boolean
UseArray = True
End Function
Public Function GetArray() As Variant
Dim vReturn As Variant
Dim vBstr As Variant
ReDim vReturn(1, 0) As Variant
vBstr = "Zero,Zero"
vReturn(0, 0) = vBstr
vBstr = "One,Zero"
vReturn(1, 0) = vBstr
GetArray = vReturn
End Function
Private vModule As Variant
Private Sub Command1_Click()
Dim o As ArraySvr.Class1
Set o = CreateObject("arraysvr.class1")
vModule = o.GetArray
Set o = Nothing
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
Dim o As ArraySvr.Class1
Dim vLocal(1, 0) As Variant
Dim i As Long
Dim bRet As Boolean
For i = LBound(vModule, 1) To UBound(vModule, 1)
vLocal(i, 0) = vModule(i, 0)
Label1.Caption = vLocal(i, 0)
Set o = CreateObject("arraysvr.class1")
bRet = o.UseArray(vLocal)
Next i
Set o = Nothing
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
Private Sub Command2_Click()
Dim o As ArraySvr.Class1
Dim vLocal(1, 0) As Variant
Dim i As Long
Dim bRet As Boolean
Dim vTmp as Variant 'temporary variable for passing argument
For i = LBound(vModule, 1) To UBound(vModule, 1)
vLocal(i, 0) = vModule(i, 0)
Label1.Caption = vLocal(i, 0)
vTmp = vLocal
Set o = CreateObject("arraysvr.class1")
'instead of passing vLocal directly, we pass vTmp
bRet = o.UseArray(vTmp)
Next i
Set o = Nothing
End Sub
Additional query words: kbdss kbDSupport kbVBp Access Violation MDAC 2.0 kbMDAC200 kbCompiler kbVBp500bug kbVBp600fix
Keywords: kbbug kbfix KB193367