Gary,
>Thank you again for your reply.
>
>How would I handle the case of having a link list of classes. I may have just one instance of the class, or I may have multiple instances of the same class. I will never know how many classes I will have, so declaring seperate instances of the same class may not be an option for me
>
>I tried doing the following in code:
>
>
> Dim oClass As New clsString
>
> Dim oLinkListNode As New LinkedListNode(Of clsString)(oClass)
> Dim oLinkList As New LinkedList(Of clsString)
>
> oClass.strString = "1"
> oLinkList.AddFirst(oLinkListNode)
>
> oClass.strString = "2"
> oLinkList.AddLast(oClass)
>
> oClass.strString = "3"
> oLinkList.AddLast(oClass)
>
> DisplayLinkList(oLinkListNode)
>
>
>But the display would come back as
>
>"3"
>"3"
>"3"
Again, you are only creating one node instance, and then your code just changes that instance's text string multiple times. So, whatever you set it to last is what it will be. You have added the same node to the linked list three times, so that's why you're getting the number "3" listed three times.
If you need to something more generic, you can declare your linked list and linked list node variables first:
> Dim oLinkListNode As New LinkedListNode(Of clsString)(oClass)
> Dim oLinkList As New LinkedList(Of clsString)
Then create a for loop where you create a new instance, set the text, and add it to the linked list. Here's the high level overview:
Dim i As Integer
For i = 0 To 10
Next d
Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com