Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set picture on Crystal Report from VB runtime? 3

Status
Not open for further replies.

cfkeem

MIS
Jun 15, 2002
10
0
0
SG
hi,

How to set picture on Crystal Report from VB runtime?

For example to print employee photo on the pass,

note:
The photo is store at windows folder not database.

regards,

Steward

 
The only way that I know how to do this is with the Crystal Reports RDC. I am assuming that you have the path to the picture stored in your database, if so follow these basic steps.

1. Place a picture box (Picture1 - ICROleObject)in the section that you want the picture to appear (Section3).

2. Place a field that will pull the path of the picture from the database (field1), and set its suppress property to true. You don't want this to appear on the report.

3. Place the following code in the section Format event of the report.

Private Sub Section3_Format(ByVal pFormattingInfo As Object)
Set Picture1.FormattedPicture = LoadPicture(Field1.Value) 'changes the picture in the section
End Sub

That's all there is to it. You can place this a details section and have a different picture for each record.

Thanks and Good Luck!

zemp
 
Just note the report has to be converted to a DSR to get a formatting event for the section. You can't do this with RPT files unless you convert the RPT to a DSR. The article about this is on CD's website, article# C2004336. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Hi Zemp & Kenhamady,

I have found a solution to resolve this issue based your inputs.

Thank you.

Steward
 
I glad. Take the time to post your solution. It will help someone else down the road and I would be interested in it if you found another possibly better method. Thanks and Good Luck!

zemp
 
Hi Thanks for the information. How can i convert and existing rpt file to dsr one?
 
I found a way to do it via a COM data driver. I'm building a utility to make it general purpose. Should be ready to go in a couple of weeks.

I have another approach if you want to email it, and that will be revealed in the March Crystal Clear.
Editor and Publisher of Crystal Clear
 
The March Crystal Clear has a description of four methods to do this, and I've added a FAQ on Tek-Tips with the same information.

cViewIMAGE is a COM data driver that you configure to identify the table and field with the image name. It then presents the image to the report in a COM data set.

The SMTP UFL takes a different approach and can burst a report into seperate email messages. The messages can be formatted HTMl and can include embedded images.

Editor and Publisher of Crystal Clear
 
chelseatech - Sounds good! Any way to get some sample code. Do you have any lionks to any samples?

FYI the faq mentioned is faq767-3609.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top