|
|
Title | Display images with file names stored in a database |
Keywords | database, image, picture, filename, file name |
Categories | Database, Graphics |
|
|
Bind a hidden label to the filename field. In the Data control's reposition event handler, use LoadPicture to load the picture.
|
|
' Load the picture for this record.
Private Sub Data1_Reposition()
Picture1.Picture = LoadPicture( _
App.Path & "\" & lblHiddenFileName.Caption)
Picture1.Left = _
(Data1.Left + Data1.Width - Picture1.Width) / 2
End Sub
|
|
This method is very simple and keeps the database small because the picture is stored externally. One drawback is that a picture file may be deleted without removing the corresponding database record or vice versa. To avoid some problems, you should probably use an error handler to protect the LoadPicture statement and display a default "missing" picture if the file is missing.
|
|
|
|
|
|