The trick is figuring out which .NET types to use that will match up with what the underlying COM implementation is expecting after the .NET data types are marshaled to unmanaged code. I haven't seen your code, but from what you're describing it sounds like there are two potential marshaling problems: a.) the type of the index array and b.) what to use for NULL when you want to extract a range of a given dimension. Try using an array of objects instead of an array of longs for a.) and try using DBNull.Value for b.). For example, here's a VB.NET equivalent of the example in the IndexArray documentation that will work with the interop interfaces for CWArray (note the loops use syntax that was added in Visual Studio .NET 2003, so you may need to adjust it if you'
re still using Visual Studio .NET 2002):
Dim a(4, 5) As Double
Dim l As Integer = 0
For j As Integer = 0 To 4
For k As Integer = 0 To 5
a(j, k) = l
l += 1
Next
Next
Dim result() As Double
' Result is a 6-element array { 12, 13, 14, 15, 16, 17 }
result = AxCWArray1.IndexArray(a, New Object() {2, DBNull.Value})
' Result is a 5-element array { 1, 7, 13, 19, 25 }
result = AxCWArray1.IndexArray(a, New Object() {DBNull.Value, 1})
Please reply to let us know if this helped resolve your issue. If not, please post sample code that reproduces your problem. Thanks.
- Elton