Picture from file

Hi I'm comming from Access and are new to Visual Studio 2005 (BETA 2).

I'm trying to get a picture box updated from a file location rather than from a database.

I found this code in MSDN:

PrivateSub LoadNewPict()

PictureBox1.Image = Image.FromFile _

(System.Environment.GetFolderPath _

(System.Environment.SpecialFolder.Personal) _

&"\Image.gif")

EndSub

How can i change the code to function with a fixed file path (W:\Pictures\ProductPictures\) And the file name is the value of a textbox1 on a form1 connected to a SQL database. The pictures could be either JPG or BMP (can i use wild cards for the extension?)
Is it possible to get the subrutine to run every time the record changes?

Thanks & Regards
MobiTech

[1132 byte] By [MobiTech] at [2008-1-25]
# 1

This is a forum for device development. The fact that you refer to a path "W:\..." indicates you are targeting the PC; in that case please use the appropriate forum.

For device project Image.FromFile is not supported and explicitly creating a Bitmap is the correct approach. To check for files with different extensions use File.Exists to see which one is present.

Cheers
Daniel

DanielMoth at 2007-8-21 > top of Msdn Tech,Smart Device Development,Smart Devices General...