Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array issue

Status
Not open for further replies.

Dashley

Programmer
Dec 5, 2002
925
US
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!

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}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top