I'm having teouble populating an array. I rarely use them.
There are three rows of test data and I can step through it and see them all in the dataset and they do populate dthe var's correctly. Only the last row retreived winds up in the finsihed array (last line of code). I've never seen a construct like the sample they gave me and have tried to redim (and preserve) it with no luck. Can you help. Thanks!
There are three rows of test data and I can step through it and see them all in the dataset and they do populate dthe var's correctly. Only the last row retreived winds up in the finsihed array (last line of code). I've never seen a construct like the sample they gave me and have tried to redim (and preserve) it with no luck. Can you help. Thanks!
Code:
Dim oCommodity = New Commodity
For I As Int32 = 0 To dsload.Tables(0).Rows.Count - 1
With oCommodity
.nmfcClass = (dsload.Tables(0).Rows(I).Item("class"))
.pieces = (dsload.Tables(0).Rows(I).Item("quantity"))
.weight = (dsload.Tables(0).Rows(I).Item("totalweight"))
End With
Next
Dim commodityArray As Commodity() = New Commodity() {oCommodity}