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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Display of Image File--using vb, sybase, crystal

Status
Not open for further replies.

work0r

Programmer
Feb 4, 2004
3
US
Hi,
I've been googling and reading up on this for the past 3 days. I'm completely new to vb and crystal... Got this assignment because no one else knew vb. What I'm trying to do is this : In my database i have character strings, since bmps are too large to store in my situation. I need to create an ocx in vb wich reacts to the section format event from crystal. Somehow I need to get from this event the location in the database where my image sits. After i render the image through vb i then need to get this bmp filename back to crystal so he can display the image. This will all be occuring at run time -- sorry if the question is simple... like i said i've got about 3 days self training in this matter. Here is what i have pieced together so far, with some help from crystal examples:

Dim Appl As New CRAXDRT.Application
Dim Report As CRAXDRT.Report

Dim WithEvents CrSecPH As CRAXDRT.Section 'dim with events so we can access the format event
Dim CrSecs As CRAXDRT.Sections
'Public Pic1 As CRAXDRT.OLEObject 'Dim an object for the ole pictures so we can change the pic

Public success As Long
Public sigdisp As New ENFORMSIGDISPLAYLib.ENFormSigDisplay
Private Sub CrSecPH_Format(ByVal pFormattingInfo As Object) 'catches event from crystal... i think
'For now I am using a hard coded bmp character string for testing, this value needs to be taken from db.
'setoposbcnibblesignaturedata takes my character string and turns him into a bmp.
sigdisp.SetOPOSBCNIBBLESignatureData (&quot;'????????14002701280013014<00??006800>;007<00=?007000>;005400070130002;0114004?0100006301040077011800'&quot;)

'Writes the signature data to a file
success = sigdisp.WriteSignatureToFile(&quot;C:\BMPTEST.BMP&quot;, 1, 38 * 8, 9 * 8, True)

End Sub


Private Sub Form_Load()
Set Report = Appl.OpenReport(App.Path & &quot;\pic.rpt&quot;, 1) 'opens the rpt.

Set CrSecPH = Report.Sections(&quot;PH&quot;) ' set this section object to the page header


For i = 1 To CrSecPH.ReportObjects.Count 'Loop through the report objects and see if they are pictures
If CrSecPH.ReportObjects(i).Kind = CRAXDRT.CRObjectKind.crOleObject Then ' if it is a CrOleObject then
'Set Pic1 = CrSecPH.ReportObjects(i) 'Set the pic1 object to the Ole Report object
'Seems like in here somewhere i need to find out what the name of the
'event is so that i can find the database field from that name.
End If
'set pic1 = crsecph.ReportObjects(i).
Next i

End Sub



As you can see any help would be appreciated. Thanks in Advance.

rock



 
There's a solution in this thread that might work for you: thread222-501973.

-dave
 
The custom OCX won't work in CR9 or above, and the &quot;Export&quot; function doesn't cause the section formating events to occur, so it doesn't work there either.

We found four approaches to this problem and publshed it in Crystal Clear last year.

The best solution (for Cr8.5 and above) is to use our cViewIMAGE COM data provider.
1. Create a subreport that uses the cViewIMAGE.SingleIMAGE data source.
2. In the subreport, display your image as required. The COM driver returns a single record data set with the embedded image.
3. Link the field or a formula in your main report to the subreport

Works like a charm.

Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top