J
JAG
I'm missing something with regard to navigating a key/value pair
collection by index and can't figure out what it is. The following
code works correctly, allowing me to navigate through the collection
one item at a time using the index (idx) and I was hoping to do the
same for a key/value pair collection but the index behaves a bit
differently:
Private myLink As New List(Of String)
Private idx As Integer = -1
Private count As Integer = 0
Private Function setLink(ByVal currDoc As String)
myLink.Add(currDoc)
count = count + 1
idx = idx + 1
End Function
Private Sub Back_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Back.Click
If idx > 0 Then
idx = idx - 1
ShowImage(myLink(idx))
End If
End Sub
Public Sub ShowImage(ByVal currImage As String)
PictureBox1.Image = Nothing
Dim MyImage As Bitmap
MyImage = New Bitmap(currImage)
setLink(currImage)
PictureBox1.Image = CType(MyImage, Image)
PictureBox1.Show()
End Sub
In the key/value pair collection, the index seems to return a
number(value of idx) of characters for an item in the collection:
Private myLink As New List(Of KeyValuePair(Of String, String))
Why does the index work for List(Of T) and not for List(Of
KeyValuePair)?
Thanks for your input,
Matt
collection by index and can't figure out what it is. The following
code works correctly, allowing me to navigate through the collection
one item at a time using the index (idx) and I was hoping to do the
same for a key/value pair collection but the index behaves a bit
differently:
Private myLink As New List(Of String)
Private idx As Integer = -1
Private count As Integer = 0
Private Function setLink(ByVal currDoc As String)
myLink.Add(currDoc)
count = count + 1
idx = idx + 1
End Function
Private Sub Back_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Back.Click
If idx > 0 Then
idx = idx - 1
ShowImage(myLink(idx))
End If
End Sub
Public Sub ShowImage(ByVal currImage As String)
PictureBox1.Image = Nothing
Dim MyImage As Bitmap
MyImage = New Bitmap(currImage)
setLink(currImage)
PictureBox1.Image = CType(MyImage, Image)
PictureBox1.Show()
End Sub
In the key/value pair collection, the index seems to return a
number(value of idx) of characters for an item in the collection:
Private myLink As New List(Of KeyValuePair(Of String, String))
Why does the index work for List(Of T) and not for List(Of
KeyValuePair)?
Thanks for your input,
Matt