displaying product pictures from database

C

campbellbrian2001

Thanks All,
I have a vb.net desktop application form from which a user chooses a
product code from a database (Access97) using a comboBox. Each record
of the database has a field giving the address of the .jpg file
associated (e.g. Item #7925354 has a .jpg in folder
F:/productPicures/7925354). I need to programmatically display the .jpg
when the user chooses a product. Obviously I don't want the actual .jpg
to be stored in the database to avoid bloat, that's why the record has
only a path. Any clues? Thanks! Brian


BTW: Here's the code I used when I did all this in Access97 (VB6.0):


Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me!Picture
'gets picture corresponding to item number
End Sub
 
C

Chris

Thanks All,
I have a vb.net desktop application form from which a user chooses a
product code from a database (Access97) using a comboBox. Each record
of the database has a field giving the address of the .jpg file
associated (e.g. Item #7925354 has a .jpg in folder
F:/productPicures/7925354). I need to programmatically display the .jpg
when the user chooses a product. Obviously I don't want the actual .jpg
to be stored in the database to avoid bloat, that's why the record has
only a path. Any clues? Thanks! Brian


BTW: Here's the code I used when I did all this in Access97 (VB6.0):


Private Sub Form_Current()
On Error Resume Next
Me![ImageFrame].Picture = Me!Picture
'gets picture corresponding to item number
End Sub

Am I missing something or can't you just use a picture box?

PictureBox.Image = Image.FromFile(Path)

Chris
 
H

Herfried K. Wagner [MVP]

I have a vb.net desktop application form from which a user chooses a
product code from a database (Access97) using a comboBox. Each record
of the database has a field giving the address of the .jpg file
associated (e.g. Item #7925354 has a .jpg in folder
F:/productPicures/7925354). I need to programmatically display the .jpg
when the user chooses a product. Obviously I don't want the actual .jpg
to be stored in the database to avoid bloat, that's why the record has
only a path.

\\\
Private m_CurrentPicture As Image
..
..
..
Private Sub DisplayRecordData(...)
If Not m_CurrentPicture Is Nothing Then
Me.PictureBoxProductPicture.Picture = Nothing
m_CurrentPicture.Dispose()
End If
m_CurrentPicture = Image.FromFile(...)
Me.PictureBoxProductPicture.Picture = m_CurrentPicture
End Sub
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top