Solved

Pass image from c# to access

Posted on 2011-09-20
8
307 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
  • 4
  • 3
8 Comments
 
LVL 49

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
 
LVL 49

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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 1

Author Comment

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

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 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now