<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2726.2500" name=GENERATOR></HEAD>
<BODY style="MARGIN-TOP: 2px; FONT: 8pt Tahoma; MARGIN-LEFT: 2px">
<P><FONT size=2><SPAN class=124381017-19072003>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.</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>Scenario:</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>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.</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>Here are the
classes:</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>Public Class
Customer<BR> Public CustomerID As String<BR>
Public CustomerName As String<BR> Public CustomerOrders As
Collection</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003> Sub New(ByVal
ID As String)<BR> Me.CustomerID =
ID<BR> End Sub<BR>End Class</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>Public Class
Order<BR> Public OrderID As String<BR> Sub
New(ByVal ID As String)<BR> Me.OrderID
= ID<BR> End Sub<BR>End Class</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>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:</SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003>' Add orders to each Customer
object in the ArrayList.<BR> Dim customer1 As Customer<BR> For Each
customer1 In customerArray<BR> Dim y As
Integer<BR> For y = 0 To
14<BR>
customer1.CustomerOrders.Add(New Order("Order" +
y.ToString()))<BR> Next y<BR> Next
customer1<BR></SPAN></FONT></P>
<P><FONT size=2><SPAN class=124381017-19072003><FONT size=1><FONT size=2>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.</FONT></FONT></SPAN></FONT></P>
<DIV><FONT size=2><SPAN class=124381017-19072003><FONT size=1><FONT size=2>Any
suggestions?</FONT></FONT></SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=124381017-19072003><FONT size=1><FONT
size=2>TIA</FONT></DIV>
<P></FONT></SPAN></FONT> </P></BODY></HTML>