Hi I'm successfully making a Webservice request with the inclusion of the statements below.
I initialize the array using request.RequestedShipment.FreightShipmentDetail.LineItems = New FreightShipmentLineItem(0) {New FreightShipmentLineItem()}
Which works when there is only 1 line item/
I Can't seem to figure out how to initialize it to pass more line item (up to 5)
I plan on pulling the line items using a dataset and iterating through it to populate the array with multiple line items. The dataset is easy to do.
I've set the boundary to 4 = New FreightShipmentLineItem(3) [4 items on a zero based index] but then i get an error "array initializer missing 4 elements"
Thanks
-dan
Code:
request.RequestedShipment.FreightShipmentDetail.LineItems = New FreightShipmentLineItem(0) {New FreightShipmentLineItem()}
request.RequestedShipment.FreightShipmentDetail.LineItems(0).FreightClass = FreightClassType.CLASS_050
request.RequestedShipment.FreightShipmentDetail.LineItems(0).FreightClassSpecified = True
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Packaging = PhysicalPackagingType.SKID
request.RequestedShipment.FreightShipmentDetail.LineItems(0).PackagingSpecified = True
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Description = "Freight line item 0NE"
'
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Weight = New Weight()
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Weight.Units = WeightUnits.LB
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Weight.UnitsSpecified = True
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Weight.Value = (500)
request.RequestedShipment.FreightShipmentDetail.LineItems(0).Weight.ValueSpecified = True
I initialize the array using request.RequestedShipment.FreightShipmentDetail.LineItems = New FreightShipmentLineItem(0) {New FreightShipmentLineItem()}
Which works when there is only 1 line item/
I Can't seem to figure out how to initialize it to pass more line item (up to 5)
I plan on pulling the line items using a dataset and iterating through it to populate the array with multiple line items. The dataset is easy to do.
I've set the boundary to 4 = New FreightShipmentLineItem(3) [4 items on a zero based index] but then i get an error "array initializer missing 4 elements"
Thanks
-dan