Solved

Pass image from c# to access

Posted on 2011-09-20
8
306 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

757 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

20 Experts available now in Live!

Get 1:1 Help Now