Solved

Pass image from c# to access

Posted on 2011-09-20
8
312 Views
Last Modified: 2012-06-21
I have a c# dll that I use to capture an image (a signature). I want to return that image to my MsAccess program and display in an image/ picture box. I would prefer not to save to c:\.bmp from c# and then open from access.

I want to do something like this in Access end. (not actual code)
Dim x as myC#.dll
dim Img as image
img = x.getimage() (getimage is the c# function)

I can call the functions ok it is the format of the image that is the probem.

Thanks

0
Comment
Question by:Eamon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 250 total points
ID: 36567976
I believe the image must be a bitmap, ie. bmp.

/gustav
0
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 250 total points
ID: 36568810
<I would prefer not to save to c:\.bmp from c#>
Does that mean that you don't want to save the image to disk at all?
or
<and then open from access.>
Does that mean that you want Access to just know where the saved file is?

Image controls have a .Picture property and .PictureType property
If the .Picture property was set to say "c:\temp\SomePicture.bmp"
and  .PictureType was set to Linked, the image would update after your c#.dll saved a new picture and you requeried the control.

Is that an acceptable setup?  Or were you looking for something different?
0
 
LVL 1

Author Comment

by:Eamon
ID: 36573847
Thanks Nick.
<I would prefer not to save to c:\.bmp from c#> meant that I knew I could save from c# to file and display in access.
This is what I will do if I can just pass the image.

Do access and c# not share a same type that I can pass between.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:Gustav Brock
ID: 36573907
You could try with a Picture control:

Me!picTest.PictureData = x.getimage()

But .PictureData may be for Access internal use only as some metadata should be included in this as well.

/gustav
0
 
LVL 1

Author Comment

by:Eamon
ID: 36573934
what type of image/object should get image return
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 36574057
First choice would be bitmap.
If I recall correctly, PictureData holds a Byte array of the bitmap.

If you load a picture into your Picture control (integrated, not linked), you can save the form to a text file with SaveAsText ... and then study the generated text file for the entry, similar to this:

PictureData = Begin
0x2800000010000000100000000100040000000000800000000000000000000000 ,
0x8080000080808000c0c0c0000000ff00c0c0c00000ffff00ff000000c0c0c000 ,
0xffff0000ffffff00dadad0dadadadadaadad00adadadadaddad030dadadadada ,
0xad0330adadadadad0033300000000adaa03330ff0dadadadd03300ff0adad4da ,
0xa03330ff0dad44add03330ff0ad44444a03330ff0d444444d03330ff0ad44444 ,
0xa0330fff0dad44add030ffff0adad4daa00fffff0dadadadd00000000adadada ,
0xadadadadadadadad000000000000000000000000000000000000000000000000x0000000000000000
End

/gustav
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 36598532
Fine, but what/how did you do, please?
Could you perhaps also provide a snip of your C# code setting the format?

/gustav
0
 
LVL 1

Author Comment

by:Eamon
ID: 36598674
as you stated I just went with the bmp file. saved it to c:\ and displayed in access.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question