• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4906
  • Last Modified:

Passing Images to a Crystal report from VB.Net

I'm using Crystals Reports for Visual Studio.Net.  I want to pass an image to a report as a parameter.  I have placed an empty bitmap ICROleObject on my report, but I can't see how to set this from within my program.  Can anybody help?  Thanks.
0
useless_eater
Asked:
useless_eater
1 Solution
 
mlmccCommented:
In other versions of VB and CR you use the LoadPicture

Look at
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/cr9_vb_rdc_loadpic.exe.asp

I can't seem to find an example for VB.Net and CR.Net

mlmcc
0
 
EwaldLCommented:
the only way would be to pass it to the subreport in a dataset, ie to a subreport which would only display one field and record, which would be the image.
0
 
useless_eaterAuthor Commented:
I'm using ComponentOne Reports for .Net instead now.  Much easier.  Please close
0
 
NetminderCommented:
User resolved; points (500) refunded and question closed.

Netminder
EE Admin
0
 
domlsCommented:
Actually, you CAN set the path to a bitmap file that will replace an existing picture when using Crystal Reports in VB.  Here's how:

Using VB in Visual Studio 2010 and Crystal Reports 13.0.2000.0;

1) Right click the Crystal Reports designer page and select "Insert-->Picture".
2) Browse and insert your "dummy" picture file (i.e. bitmap)
3) Right click "Parameter Fields" and click "New" to create a new parameter called "pBmpPath"
This is so you can pass a path into the parameter's value that will be used by the dummy picture.
4) Right click the picture that you've loaded into your designer, and select "Format Object"
5) Click the picture tab
6) Click the "X-2" button located next to where it says "Graphic Location"
7) Switch to "Basic Syntax" and then paste the following formula:
formula = {?pBmpPath}

8) Save the formula by exiting both screens.
9) Now, in your subroutine where you fire up your report, do the following:
        Report_22.SetParameterValue("pBmpPath", GetAppPath() & "\MyBitmap.bmp")

Note that my report's object is called Report_22.  Just rename this to the variable that you're using for your report object.  Also, I'm using a subroutine called GetAppPath() that gets the application's runtime directory.

Now, just run your report, and voila!  Your image should be the one used at runtime!

domls
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Tackle projects and never again get stuck behind a technical roadblock.
Join Now