vb.net - load image

hello there,
how can I make something so that I can load an image into memory then display it on a picturebox..
because if I load the image into picturebox fromfile I cant edit the image because its in use..
LVL 1
XK8ERAsked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
"...because if I load the image into picturebox fromfile I cant edit the image because its in use..."

Instead of FromFile() use FromStream() which does NOT leave the file locked.

Simple example:

    Dim fs As New System.IO.FileStream("c:\some\path\image.jpg", IO.FileMode.Open)
    PictureBox1.Image = Image.FromStream(fs)
    fs.Close()
0
 
ZhaolaiCommented:
You can use ImageList to store a collection of images either at design time or run time and use it any where in your app.

0
All Courses

From novice to tech pro — start learning today.