Solved

Pass image from c# to access

Posted on 2011-09-20
8
309 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

840 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