CppMax Homepage
Forum Home Forum Home > ReportMax > ReportMax
  New Posts New Posts RSS Feed - Settting the ReportFile Property by code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Settting the ReportFile Property by code

 Post Reply Post Reply
Author
Message
Henner View Drop Down
Newbie
Newbie


Joined: 05 Oct 2015
Location: Herford/Germany
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Henner Quote  Post ReplyReply Direct Link To This Post Topic: Settting the ReportFile Property by code
    Posted: 05 Oct 2015 at 5:20pm
After some testing (much try and errorShocked) I got data visible on the report.
Now I am trying to set the ReportFile Property with this line of code in the
Report_SetDataSource Event:
Me.ReportMaxViewer1.ReportFile= myPublicStringVariable

The ReportFile Property in the Control is set to blank.
If I do so, the report opens with a grey background. No white page to see. No data to see.
When I set the ReportFile Property in the control to a valid path with a *rpm File
AND leave the code as is, then report opens as expected.

Do I use the wrong property in my code? Is there something in the "m_" class that I can use?
Or is it just the wrong event to set the ReportFile by code?

My goal is, to have just one form with one ReportMax control in it.
Then I would like to set all (or the most) properties by code (like the ReportFile)at runtime.
I will provide the user with a combobox which lists all available reports. And then the user
can choose one report from the list to open it.
Thanks again for assistance
Henner

BTW:
I tried to debug this. When I set the ReportFile by code AND the ReportFile property in the
control is set to blank, I do not reach the breakpoints in the Report_SetDataSource procedure.
If ReportFile in the control has a proper value, I can debug the procedure a usual.
Hhmm??

Back to Top
Henner View Drop Down
Newbie
Newbie


Joined: 05 Oct 2015
Location: Herford/Germany
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Henner Quote  Post ReplyReply Direct Link To This Post Posted: 05 Oct 2015 at 5:37pm
I tried to set the ReportFile with
Me.ReportMaxViewer1.LoadReportFromFile(strReportFile, 0)
on the form load event but got a grey background again.
I think this is also not the right event?
Is there any detailed description of the control and methods or events?
Thank you
Back to Top
emadns View Drop Down
Admin Group
Admin Group


Joined: 06 Feb 2012
Status: Offline
Points: 130
Post Options Post Options   Thanks (0) Thanks(0)   Quote emadns Quote  Post ReplyReply Direct Link To This Post Posted: 05 Oct 2015 at 5:40pm
ReportFile property need to be set early in the process before composing the report. SetDataSource is not an early point. It is when the report file is known and a datasource is set.

Try to set the ReportFile property at the combobox selection change event, but after you call it, you need to build the report:

Me.ReportMaxViewer1.ReportFile = <my report file path>; // relative paths are accepted
Me.ReportMaxViewer1.LoadReport();
Me.ReportMaxViewer1.ExecuteReport();


Back to Top
Henner View Drop Down
Newbie
Newbie


Joined: 05 Oct 2015
Location: Herford/Germany
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Henner Quote  Post ReplyReply Direct Link To This Post Posted: 05 Oct 2015 at 5:47pm
Thanks a lot.
I put that snippet in the form load event and it seems to work fine.
Thanks. Next question is comingBig smile
Henner
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.06
Copyright ©2001-2016 Web Wiz Ltd.