View Single Post
Old Dec 4th, 2005, 4:53 AM   #3
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,005
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by pallytruck
Right thought this would be a simple task i am so frustated. Basically i have a database with pictures. i understand basic vb and access but never tried this before and thought it would be simple when i load the form instead of the picture being in a picture box it is a jpeg or bmp icon which you click on and it loads up in a photo application say paint. What's the point in that? I want the pictues on the form. Tried everything including package settings but that won't even let me change view to picture. Is there some code i can put in and where would i put it so that it ativates when the form loads and when records are changed.
Help would be very very helpful i will email a copy of my game when it is finished as well if you can provide the answer
How are you storing the picture in the database? I assume you mean the database stores the file name; in this case, it should be easy to do. Code below is actually VB.NET; I've never used any other version of VB, so I don't know if it's the same as VB6.
' assumes fileName is a string with the bitmap's filename in it, and picBox
' is a PictureBox control.
 
Dim isValid As Boolean = True
Dim itemImage As Bitmap
Try
  itemImage = New Bitmap(fileName)
Catch ex As Exception
  isValid = False
End Try
If isValid Then
  picPreview.Image = itemImage
Else
  picPreview.Image = Nothing
End If
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote