Manish Parmar
Manish Parmar

Reputation: 859

how can i get image from listview and assign to picturebox?

i have one listview in which i have stored images, now for my slide show i want this images to picture box. but not getting exact way to get images from the listview.

can anybody has some idea about this ?

thanks in advance.

Upvotes: 1

Views: 1083

Answers (1)

BaumS
BaumS

Reputation: 55

I had a similar problem some while ago. This artical from Microsoft was very helpfull: http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.image%28VS.80%29.aspx

Especially this part

   ListViewItem selection = ListView1.GetItemAt(e.X, e.Y);

   // If the user selects an item in the ListView, display
   // the image in the PictureBox.
   if (selection != null)
   {
        PictureBox1.Image = System.Drawing.Image.FromFile(
            selection.SubItems[1].Text);
   }

Upvotes: 1

Related Questions