Arthur Fuller
artful at rogers.com
Sat Jul 19 12:38:10 CDT 2003
Before posting a bunch of code and risking rejection due to size, has anyone
played with Treeview in .NET? I'm working up a sample that dies on a
particular line and after a couple of hours staring at it, I cannot deduce
the problem. AFAIK it should work. I'll try an abbreviated version, below.
If this is not enough, and you are interested in the problem, e me off-list
and I'll send you a zip.
Scenario:
Two classes, Customer and Order, the former containing a collection of Order
objects. There is no database, I manufacture the instances in loops. I
populate the base level with a node for each of 1000 customers, then I walk
the nodes and add some orders to each customerOrders collection.
Here are the classes:
Public Class Customer
Public CustomerID As String
Public CustomerName As String
Public CustomerOrders As Collection
Sub New(ByVal ID As String)
Me.CustomerID = ID
End Sub
End Class
Public Class Order
Public OrderID As String
Sub New(ByVal ID As String)
Me.OrderID = ID
End Sub
End Class
Assume that a loop correctly builds 1000 customer nodes. There's an
arrayList that is used to fill the customer node level and then I attempt to
walk it like so:
' Add orders to each Customer object in the ArrayList.
Dim customer1 As Customer
For Each customer1 In customerArray
Dim y As Integer
For y = 0 To 14
customer1.CustomerOrders.Add(New Order("Order" + y.ToString()))
Next y
Next customer1
The line that chokes is the innermost, where I try to add a new order. Given
the class declaration above, I can't see why it doesn't work.
Any suggestions?
TIA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/dba-vb/attachments/20030719/9af77845/attachment-0003.html>