Subject: passing jagged array of objects
Posted By: nutrino Post Date: 1/27/2006 10:58:19 AM
Alas, I feel I am asking for it now.

I am trying to pass a jagged array of object to a component service.

In vb.net

I define the array as:
Dim orderLines()() As Object = New Object(10)() {}

For testing I do a VERY simple load:

orderLines(0) = New Object(3) {}
        orderLines(i)(0) = CInt(txtLineNo.Text)
        orderLines(i)(1) = txtPartID.Text
        orderLines(i)(2) = txtShipToID.Text
        orderLines(i)(3) = txtCommodityCode.Text

I call my com object trying various formats such as:

blnIsOrderValid = connection.IsOrderValid(varCustomerID, varShipVia, varFreightTerms, varLongDescription, _
                varShipToAddrNo, orderLines(10))

or
blnIsOrderValid = connection.IsOrderValid(varCustomerID, varShipVia, varFreightTerms, varLongDescription, _
                varShipToAddrNo, orderLines(10)(3))
or
            blnIsOrderValid = connection.IsOrderValid(varCustomerID, varShipVia, varFreightTerms, varLongDescription, _
                varShipToAddrNo, orderLines)

VB COM OBJECT:

Com object is set up as:
IsOrderValid(ByVal CustomerID As String, ByVal ShipVia As String, ByRef FreightTerms As String, ByRef LongDescription As String, ByVal ShipToAddrNo As Integer, OrderLines() As Variant) As Boolean

Note calling my com object was working just fine until I tried to pass the jagged array of objects OrderLines().

But now I get messages like:
Error msg: Object reference not set to an instance of an object.
Error msg: Subscript out of range.
Error msg: Specified array was not of the expected type.

Is there a simple code example I could follow?
I would very much like to keep the jagged array or objects of objects passed to a com object.

From Shakespeare: 'Lay on McDuff!'

I feel a sword about to fall.






Go to topic 36585

Return to index page 384
Return to index page 383
Return to index page 382
Return to index page 381
Return to index page 380
Return to index page 379
Return to index page 378
Return to index page 377
Return to index page 376
Return to index page 375