Can't get picture box to show image

drb2k2
04-21-2004, 03:40 PM
Hi all,
I have designed a simple app which changes pictures in a box depending on what is selected from a drop down box. I am storing the filename in a string array. However when I load the picture into the picture box, nothing happens. can anyone offer some advice.
Cheers
DRb2k2

Basically this translates to Me.PB_Box1.Image.FromFile("FileNAme")


Try
Me.PB_Box1.Image.FromFile(PicDetails(Me.LB_Step.SelectedIndex))
Catch excep As System.IO.FileNotFoundException
MessageBox.Show("File not found")
End Try

Iceplug
04-21-2004, 04:09 PM
Your code sample doesn't translate. Follow me:

Me.PB_Box1.Image.FromFile(PicDetails(Me.LB_Step.SelectedIndex))
Me.PB_Box1.Image.FromFile(PicDetails( a number ))
Me.PB_Box1.Image.FromFile(a filename)
The above line is a picture.
a picture
which needs to be assigned to something ;).
Me.PB_Box1.Image = Me.PB_Box1.Image.FromFile(PicDetails(Me.LB_Step.SelectedIndex))
Me.PB_Box1.Image = a picture
or the simple way:
Me.PB_Box1.Image = Image.FromFile(PicDetails(Me.LB_Step.SelectedIndex))
since FromFile is a shared method of the image object.

:)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum