cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Picture at Runtime VS2005

Former Member
0 Kudos

Hi

I'm using VS2005 enterprise edition and the Crystal Reports that came with that package (the file versions say they are 10.2.3600). All I want to do is insert an image at runtime, however this appears to be impossible judging by all the code I've looked through. It seems that it was easy to do with version 9 and may be possible with version 11 but I can't find any code that works with the version that comes with VS2005. Of course there's the standard method to insert an image and link it to a particular image in a folder, however this is fairly useless as when the program is deployed the user can choose which directory he installs to. So what do I have to do to get this working. Is it essential to upgrade? If so what version do people recommend? Once I have that version how do you change the image you want displayed in code (preferably VB.NET but I'm sure I can work out C#)?

Thanks

Lee Ottaway

Fusion Software (UK) Ltd

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Lee;

For the version of Crystal Reports that comes with .NET, you can use something like one of our samples shows:

https://smpdl.sap-ag.de/~sapidp/012002523100006252822008E/net_win_smpl.exe

Look for the sample, vbnet_win_DynamicImage.zip. It uses an ADO.NET dataset to change the image.

For Crystal Reports XI R2 and Crystal Reports 2008, you can more directly change the image location using built in functionality.

In the Designer, choose Insert > Picture. Choose a default image to show and save it. Right-click on it and select Format Graphic. Go to the Picture tab and click the formula button for Graphic location. Save the report.

Then, at runtime you can populate the Formula with the new location for your image, either a URL or disk file location.

See the following note for more information:

[Image|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333333373334%7D.do]

Best Regards,

Jonathan

Former Member
0 Kudos

I am having problems with dynamically setting images in Crystal Reports too. Just to give you a rundown on the environment I'm using:

I'm designing my reports in Crystal Reports XI Release 2.

- Images swopping works fine in the designer.. I can pass it values from the database or simply give it a path to an image in a string and it works fine, no problem at all.

The problem is at run time.. I'm developing in Microsoft Visual Studio 2008 (version 9.0.21022.8 RMT), which references version 10.5.3700 of the CyrstalReports.Engine to interpret crystal report files.

I have tried using VB.NET code to change the 'Location' formula field dynamically (as described in the link you provided), I've tried passing in a string parameter with the full or relative path to the image.. and I've also tried loading the image path from an OLE DB(ADO) style database connection.

None of these have worked it just loads the default image that I embedded into the report during design time.

To check that the path is being passed correctly each time I loaded it into a text object.

Has anyone got any ideas?

Many thanks for anyones help.

Answers (0)