Evening all,
Hope all are well.
As the title says im having difficulty with selecting listview item and displaying in a picturebox. Basically i want to doubleclick an image in a listview and the item will show in a picturebox. If you are able to provide assistance please let me know. i keep receiving "System.ArgumentException: 'Parameter is not valid.'" I have added my codes below.
Hope all are well.
As the title says im having difficulty with selecting listview item and displaying in a picturebox. Basically i want to doubleclick an image in a listview and the item will show in a picturebox. If you are able to provide assistance please let me know. i keep receiving "System.ArgumentException: 'Parameter is not valid.'" I have added my codes below.
VB.NET:
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Dim list As New List(Of Bitmap)
Dim gameObject As New Dictionary(Of Integer, Bitmap)
ListView1.Items.Add(0)
ListView1.Items.Add(1)
ListView1.Items.Add(2)
gameObject.Add(1, New Bitmap("Picture1.jpg"))
gameObject.Add(2, New Bitmap("Picture2.jpg"))
gameObject.Add(3, New Bitmap("Picture3.jpg"))
Dim i As Integer
i = CInt(ListView1.SelectedItems(0).Text.ToString)
PictureBox1.Image = gameObject(i)
End Sub
Last edited by a moderator: