|
-
Apr 28th, 2001, 04:21 PM
#1
Thread Starter
Junior Member
Save PictureBox contents to a file?
Help!
Here's what I'm trying to achieve...
Firstly, my project is just a database of names along with pictures of that person.
At present, I have an Access Database (created in Access 2k). The "photograph" field is set as "OLE Object".
My VB project can interface with the DB with the code below and successfuly ADD records easily. The only thing it won't do is add the record (including the picture) if I try to set RS("Photograph") = Picture1.Picture.
Code:
Dim DB as Database
Dim RS as Recordset
Set DB = OpenDatabase("C:\Control.mdb")
Set RS = DB.OpenRecordset("Staff",dbOpenDynaset)
RS.AddNew
RS("Name") = Me.txtForename & " " & Me.txtSurname
RS("Photograph") = Picture1.Picture 'it all works if I take this out
RS.Update
I want to store the contents of the Picture1 picturebox as a File in a directory, and input the file path and name into the database rather than the file itself. I don't know how to ouput the picturebox to a file.
Since the Picture1 box gets its picture from a TWAIN source (I got this bit to work), the picture doesn't actually exist as a file anywhere yet. So I need to 'dump' the contents of the Picturebox into a file in a folder somewhere. If you can help with this, please do!
And once I know how to do that, is it easy to then load the contents of a file into the picturebox again?
Many thanks for your help.
Regards,
Richard.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|