I have an existing VB.net program (using visual studio 2005) that uses class InventoryLocation, and has a child class InventoryItem. I would like to revise this code to use my new class InventorySequence, which has a new primary key, includes the fields from the other classes, but does not have any child classes.
The main part of my issue is that I do not understand "KeyValuePair". From what I understand, KeyValuePair has one key and one value. In InventorySequence, I have one key, but three values. Please advise - what can I use instead of KeyValuePair? See existing code I would like to change at the bottom:
Public Class InventoryLocation ' original coding
    Public Location As String = ""
    Public Items As InventoryItems
    Public Sub New(ByVal location__1 As String)
        Location = location__1
        Items = New InventoryItems()
    End Sub
End Class
Public Class InventoryLocations
    Inherits SortedList(Of String, InventoryLocation)
End Class
'----
Public Class InventoryItem  ' original coding
    Public Location As InventoryLocation
    Public Quantity As UInteger = 0
    Public Barcode As String = ""
    Public Sub New(ByVal location__1 As InventoryLocation, ByVal quantity__2 As UInteger, ByVal barcode__3 As String)
        Location = location__1
        Quantity = quantity__2
        Barcode = barcode__3
    End Sub
End Class
Public Class InventoryItems
    Inherits SortedList(Of String, InventoryItem)
End Class
'----
Public Class InventorySequence ' my coding - need new itemseq to be the primary key
    Public ItemSeq As UInteger = 0
    Public Location As String = ""
    Public Quantity As UInteger = 0
    Public Barcode As String = ""
    Public Sub New(ByVal itemseq__4 As UInteger, ByVal location__1 As String, ByVal quantity__2 As UInteger, ByVal barcode__3 As String)
        ItemSeq = itemseq__4
        Location = location__1
        Quantity = quantity__2
        Barcode = barcode__3
    End Sub
End Class
Public Class InventorySequences
    Inherits SortedList(Of String, InventorySequence)
End Class
'---------------------------- How do I replace this code to do the same thing but use my InventorySequence class?
Dim index As Integer = 0
For Each kvpLocations As KeyValuePair(Of String, InventoryLocation) In Inventory.Locations
    Dim searchLocation As InventoryLocation = kvpLocations.Value
    If searchLocation.Location = inventoryItem.Location Then
        For Each kvpItems As KeyValuePair(Of String, InventoryItem) In searchLocation.Items
            Dim searchItem As InventoryItem = kvpItems.Value
            If searchItem.Barcode = inventoryItem.Barcode Then
                Exit For
            End If
            index += 1
        Next
        Exit For
    Else
        index += searchLocation.Items.Count
    End If
Next
