Hello, I have a ListBox.

When I load up an image, a entry in added to the ListBox with the location of the image file. I also have a PictureBox... when you click a item in the listbox, I need the PictureBox to load the image associated with the ListBox entry.

I tried this, but of I course it didn't work:

Private Sub import_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles import.Click
Dim dlg As DialogResult = openfile.ShowDialog()
Dim filename As String = openfile.FileName
Images.Items.Add(filename)
Dim selectpic = New Bitmap(Images.SelectedItem.Text)
PictureBox1.Image = selectpic
End Sub


Now I know this is incorrect:

Dim selectpic = New Bitmap(Images.SelectedItem.Text)

But I am stumped on what to do, can I set a variable for each new entry which contains the image?