Using My.Settings Variables within Crystal Report - vb.net

I have 2 Settings in my.settings within my vb.net Project called
my.settings.company
my.settings.tel
and I would like these to be displayed at the top of my Crystal Report.
I tried using the Database Expert within my report and added the .NET Object "My.Settings" to the Report and then dragged the company and tel variables to my report, however this doesn't work at all.
Any help ???

The easiest and probably the right way is to define parameters and to set their values from your application

Related

How to Call a function into rdlc report

I'm using visual studio to create a rdlc report with a function named NoToTxt that converts numbers in some fields into words
I put it in the Code area of Report Properties then I tried to call it to a textbox using an expression like this
Code.NoToTxt (Fields!Number.Value)
but it didn't work
any ideas that might help me to overcome this issue
I made a lot of research, but I didn't come with anything yet.

Dataset/datasource Winform VB project using ReportViewer

We are trying to figure out how the ReportViewer works and are stuck at the dataset/datasource part. We have a sql-query that connects with 3 different Servers. Is there a simple way to connect a rdlc report to such a dataset in a winform Project that will be shown in Report Viewer?
You have to add a ReportDataSource object to the LocalReport.DataSources Property. The constructor take two parameters.
First the name of the dataset (as it is defined in the rdlc repport), second a datasource object which could be any .Net Collection (ADO.Net DataSet or a simple List of object).
The mapping to the field declared is done in the same way than DataBinding. Just have the same name for the column of the ADO.Net DataSet or the property of the object in the list than the field in the report.
Take a look at
https://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport.aspx

Crystal report copy to output directory set to copy always

i am using crystal report in vb.net however every time i've create a new crystal report in my project solution the property of my crystal report is always set to 'Do not Copy'. My question is, is there any way that if i create a new crystal report the properties of it will always set to copy always so that it will lesser my time work.
if there is any step or strategy on how to do it please share it.
thanks in advance :)
i think that is the default value of crystal report every time you create it. i don't know if there is a solution but in my case i always click the properties of my crystal report file and change it to copy always.
i can suggest to your question is just patience.

Unable to programatically reference subreport property (EnableExternalImages) from main report

I have what i think is a unique requirement not addressed in other questions. I've developed a local report in Microsoft report designer as an rdlc and am viewing it via the report viewer control. The report contains a subreport. The subreport renders images from external files. The problem is that i need to programmatically set the EnableExternalImages property of the subreport at run time. Without this, the subreport refuses to render ("Error: Subreport could not be shown" is the error message i get). I've set this property on the main/outer report programatically without issue using this statement:
Me.ReportViewer1.LocalReport.EnableExternalImages = True
However i need to do the same on the sub-report...so optimally, i would like to code something like this:
Me.ReportViewer1.LocalReport.Subreport1.EnableExternalImages = True.
Problem is, i don't see a property available that provides me direct access to the subreport's properties in this fashion. I've looked into using the SubreportProcessingEvent, however this event only exposes a limited number of properties of the sub-report (Reportparamaters, Datasources, ReportPath, etc..), but does not provide me with access to all of it's properties (e.g. EnableExternalImages property).
Thanks for any information...

Displaying multiple Reports in a single report viewer

i want to know is it possible to bind my all crystal reports to a single reportviewer, somewhat in tabbed view or treevie. If tabbed then visible through navigation button.
If yes then how?
any help would be highly appreciated.
Amit Ranjan
Having reviewed the micrososft documentation, it seems you can not bind multiple reports to a viewer. As suggested here:
"Displaying a report using the CrystalReportViewer control
The CrystalReportViewer control displays only one report at a time. Which report is displayed by the control is determined by which report you bind to your code. To tell the control which report to display, you bind the ReportSource property of the control to a particular report. At runtime, the control loads the report that is bound to the ReportSource property and displays it. "
The diocumentation goes on to say you can only bind a report type to the report source.
So, basically you need to build the multi view yourself. In my mind this can be done in two ways.
Create a report viewer for each
report (maybe using a tab control)
Create a single viewer and display
different reports based on what the user
selects in your application. i.e.
I have done something simular in the past, but rather than using the report viewer, i used crystal to export the report to pdf and displayed those to the user.
I hope this is clearer. :-)
Could you not hold your reports in a hierarchical structure in memory , which relates to a visible tree view and displayed the relevant report one at a time as the users selects various nodes..
If you can't pass a colection of reports to your viewer. I would hold a list of reports in a Dictionary or some other kind of list , which has a report and an identifier for that report.
Then display a tree view which represents the reports structure you have, with each node holding the id of the report it represents, when the user selects the a TreeView node, you can look up you report from the dictionary and load it into the report viewer.
I hope that makes sense...