?
Solved

Pass image from c# to access

Posted on 2011-09-20
8
Medium Priority
?
314 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 51

Accepted Solution

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

/gustav
0
 
LVL 26

Assisted Solution

by:Nick67
Nick67 earned 1000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 51

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 51

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 51

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

770 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