Hi All,
This is my first post for quite some time, having been active on some of the Oracle forums a while ago. I hope someone out there can point me in the right direction.
I'm picking up VB.Net using Visual Basic 2010. I've used linked lists in C very effectively in the past, and I'd like to acheive the same goal in VB. However, I'm trying to create a linked list of a structure type, and I have a problem trying to 'search' for an element in the list. I've searched around the web but not found anything that conslusively answers my question. Have a look at this code:
So now I have 3 elements in my list.
1) Is there anything wrong in the way I have coded this?
2) How do I search for and remove the element where theName = "Name 2"?
This is my first post for quite some time, having been active on some of the Oracle forums a while ago. I hope someone out there can point me in the right direction.
I'm picking up VB.Net using Visual Basic 2010. I've used linked lists in C very effectively in the past, and I'd like to acheive the same goal in VB. However, I'm trying to create a linked list of a structure type, and I have a problem trying to 'search' for an element in the list. I've searched around the web but not found anything that conslusively answers my question. Have a look at this code:
Code:
Structure structType
Public theDate As Date
Public theName As String
End Structure
Private Sub test()
Dim structLinkList As New LinkedList(Of structType)
Dim element As structType
' Add the first element
element.theDate = Now()
element.theName = "Name 1"
structLinkList.AddLast(element)
' Add another
element.theDate = Now()
element.theName = "Name 2"
structLinkList.AddLast(element)
' Add another
element.theDate = Now()
element.theName = "Name 3"
structLinkList.AddLast(element)
For Each element In structLinkList
MsgBox(element.theName)
Next
End Sub
So now I have 3 elements in my list.
1) Is there anything wrong in the way I have coded this?
2) How do I search for and remove the element where theName = "Name 2"?