Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Save an Image Control content to a Binary File 1

Status
Not open for further replies.

donallan

Programmer
May 6, 1999
6
CA
I am trying to save the contents of an Image Control into a binary file.&nbsp;&nbsp;I do not wish to use the SavePicture function thereby saving the image (selected by the user) as a seperate file from the data entered in my form.&nbsp;&nbsp;I need to save the form's text data together with the image into one binary file.<br>
 
you cant do this? :<br><br>open &quot;temp.bmp&quot; for binary as #1<br><br>put #1, , imagelist1.ListImages.Item(1)<br><br>close #1 <br><br><br>I dont know why that wouldn't work... if you figure it out.. please post it.. thx<br><br>
 
I get a &quot;Can't Get or Put an object reference variable or a variable of user-defined type containing an object reference&quot; error when I try your suggestion.<br><br>I have the user select the &quot;photo&quot; of the employee through an Open Dialog and place the selected *.bmp in the imgEmployee.Picture object.&nbsp;&nbsp;This way the supervisor can see the employee that they are entering work related information on.<br><br>When the user has entered all the pertinent info on the employee I need to save all the data and the photo (*.bmp) into one binary file.
 
<br>Interesting. Yea it's an object reference, a re-occouring theme. Can't just pass a pointer to a buffer kind of thing.<br><br>This guy, 'imagelist1.ListImages.Item(1)', is a reference to a member method/function, which when executed, will return the images' binary data. Incidently, the call expects a container that knows how to handle the raw image data returned. The 'Put #1' call expects a buffer filled with (binary) data. The compiler watches for invalid lvalues, and this is an invalid value so..<br><br>you'll need to write the image to disk first, read it back into a buffer, then provide that buffer to your call to 'Put'<br><br>ie. <br>sub DoPictureStuff ()<br><br>SavePicture imagelist1.Picture &quot;C:\temp\temp.bmp&quot;<br><br>Dim binBuffer<br>Open &quot;C:\temp\temp.bmp&quot; for binary as #1<br>&nbsp;&nbsp;Put #1, , binBuffer<br>Close #1<br><br>... now, pass 'binBuffer' to your write routine.<br>' ..<br>' ..<br>' ..<br>End&nbsp;&nbsp;Sub<br><br>Incidently, from what you have have written, I'd suggest you disregard all that I've written and use a JET Database to store this stuff instead.<br><br>have fun. <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Thanks Amiel.&nbsp;&nbsp;That is exactly what I had to do.&nbsp;&nbsp;Thanks to Person012483 as well - you started me down the right path.&nbsp;&nbsp;Can't use the JET Database for security reasons (.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top