Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Using AxCWArray in ComponentWorks 3.0.1 with VB .Net 2002

When I ran a VB code in Visual Studio .NET 2002 using AxCWArray, an error message popped up:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occured in macorlib.dll. Addtional information: Catastrophic failure.

Here is the example code:

Dim a(4, 5) As Double
Dim j, k As Integer
Dim l As Integer = 0
For j = 0 To 4
For k = 0 To 5
a(j, k) = l
l += 1
Next
Next
Dim result() As Double
result = AxCWArray1.IndexArray(a, New Object() {2, DBNull.Value})
result = AxCWArray1.IndexArray(a, New Object() {DBNull.Value, 1})

Any comment?


Rong Zhu
Tyco Telec
ommunications
0 Kudos
Message 1 of 3
(6,019 Views)
Could you please post a test project that reproduces this error? I created a new project, added a CWArray control to the form, added a button, added an event handler for the button's click event, and copy & pasted your code. This worked fine on my machine.

- Elton
0 Kudos
Message 2 of 3
(6,019 Views)
Elton,

Thank you for answering my question. I tried the AxCWArray ActiveX control, and it works. In my original code generating the error message, I used the control class: CWArray, and sorry for the confusion. Here is the code:

sub test()
dim CWArray1 as CWInstrumentControlLib.CWArray
CWArray1 = new CWInstrumentControlLib.CWArray
Dim a(4, 5) As Double
Dim j, k As Integer
Dim l As Integer = 0
For j = 0 To 4
For k = 0 To 5
a(j, k) = l
l += 1
Next
Next
Dim result() As Double
result = CWArray1.IndexArray(a, New Object() {2, DBNull.Value})
result = CWArray1.IndexArray(a, New Object() {DBNull.Value, 1})

end sub

Rong Zhu
0 Kudos
Message 3 of 3
(6,019 Views)