Farook
Farook

Reputation: 85

How to display images in a listview

I have a couple of images in a imagelist1. I'd like to display images in listview1 control (or something else recommended by someone). Once the image is selected it should display in a picturebox1. I should be able to navigate through (next/previous) pictures and I should also be able to delete pictures.

ImageList1.Images.Add(Image.FromFile(OpenFileDialog1.FileName)) not adding files!

Upvotes: 2

Views: 15275

Answers (1)

Flaick
Flaick

Reputation: 232

The code isn't completed; you have also to add an Item in your ListView1 control, and after you have to say that this Item has the new Image. Here an example:

    Dim newImageKey As String = "<Type here a Key for the image>"
    ImageList1.Images.Add(newImageKey, Image.FromFile(OpenFileDialog1.FileName))
    ListView1.Items.Add("<Your Key Node>", "<Your Text Node>", newImageKey)

Upvotes: 1

Related Questions