• Welcome to Theos PowerBasic Museum 2017.

Fastreport blank report

Started by Roslan Salleh, January 29, 2009, 07:18:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roslan Salleh

Does anyone here familiar with FastReport. I should ask at their forum but I think this is related to Powerbasic.

I try to show report that I prepared using FastReport designer using powerbasic.

#Include "fastreport4680.inc"

   Dim report As IfrxReport
   Static sFileName As string
   Dim result As Integer

   report = newcom $PROGID_FastReport_TfrxReportTfrxReport
   
   If IsFalse(IsObject(report)) Then
      MsgBox "Not Good"
      Exit Sub
   End If
   sFileName = app.Path & "report.fr3"
   report.LoadReportFromFile("report.fr3")
   report.EngineOptions.SilentMode = %simMessageboxes
   report.PrepareReport(%TRUE)
   report.PreviewPages.AddEmptyPage(1)
   report.ShowReport()   

I am using powerbasic com browser to generate include file.

The problem is that the prepared report do not appeared just preview windows with no report.

They have many example using vb to show report. What I see is that they define DIM WithEvents report as frxreport.
So I think the problem is regarding withevents. How do we declare object in powerbasic to do with WithEvents?

Or something wrong with my coding?
Somebody please help me.

José Roca

#1
 
It is difficult to give advice without having the definitions of the interfaces.

In the first place, app.Path is a VB function. In the second place, you must use unicode strings.

Try the following:


sFileName = UCODE$(EXE.Path$ & "report.fr3")
report.LoadReportFromFile(sFileName)


Quote
How do we declare object in powerbasic to do with WithEvents?

Again, WithEvents is a VB statement. With PB you have to use the class for the appropriate events interface generated by the COM browser and use the EVENTS statement (see the help file) to sink with it.

Roslan Salleh

Thank you jose.

I already figured it out. I changed sFileName to variant type and it worked.
I read the powerbasic help file, they mention to use variant type to comunicate with COM.

I can load the report but there is a function by the COM to alter the variable inside the report.
I tried using variant type to pass the variable to the function , but not worked.

So I get frustrated. I changed my mind to use freely available report manager by toni martir.
He provide with visual basic wrapper to access report. It worked with powerbasic too. Great.