0

Hi all,

I'm making a program that can search for all .JPG files and display them in a ListBox. Now I want it to display the selected ListBox Item in the PictureBox1.

The files in the listbox are listed like this :

C:\Documents and Settings\My pictures\Image01.JPG


Thanks,

Vhyr.

4
Contributors
3
Replies
11
Views
7 Years
Discussion Span
Last Post by Reverend Jim
0

Here you are

PictureBox1.Image = Image.FromFile(<a filename selected from the listbox>)

There's a DaniWeb's search in the upper right corner. You can try words "vb.net picturebox file" and you'll find the snippet above. With "vb.net listbox file names" you'll find snippets about listbox handling.

HTH

0

I'm making a program that can search for all .tif files and display them in a ListBox. Now I want it to display the selected ListBox Item in the PictureBox1. Can anyone tell me how to solve this

0

I did the same thing for a browser app that I wrote. I also wanted to be able to rename the current file but I ran into problems because loading the file directly leaves the file in use. If you load the image using a filestream then the file is released.

Dim fs As New System.IO.FileStream(filename, IO.FileMode.Open, IO.FileAccess.Read)
pbxPicture.Image = System.Drawing.Image.FromStream(fs)
fs.Close()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.