Panels and UserControls

C

Charles A. Lackman

Hello,

I have a panel that is being filled with UserControls based on the Number of
Rows inside a Dataset. This works great, but when I dump the contents into
a new table it does not work the way it should. i.e.

Dim aControl As UserControl
OrderDataset.Tables("Temp").Clear()
Dim ADatarow As DataRow

For Each aControl In OrderPanel.Controls
ADatarow = OrderDataset.Tables("Temp").NewRow()
ADatarow("ItemID") = CType(aControl, OrderControl).Item
ADatarow("AssetID") = CType(aControl, OrderControl).TheIndex
ADatarow("SDescription") = CType(aControl, OrderControl).Description
ADatarow("SpaceDescription") = CType(aControl, OrderControl).Space
ADatarow("DepartmentDescription") = CType(aControl, OrderControl).Department
ADatarow("ShipTo") = CType(aControl, OrderControl).ComboShip.SelectedIndex
OrderDataset.Tables("Temp").Rows.Add(ADatarow)
Next

if there are 4 controls inside the panel four rows are placed inside table
"Temp" but Row 0 and Row 3 are always the same (but in reality they are
not). It does not matter how many rows there are the first and last are
always the same. i.e.

Row 0 ItemID = 1234
Row 1 ItemID = 5678
Row 2 ItemID = 9876
Row 3 ItemID = 1234 (but should be 3423)

What am I doing wrong?

Any Suggestions will be greatly appreciated.

Thanks,
Chuck
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top