<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://vstoolsforum.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Crystal Reports</title><subtitle type="html">Notes, Tips and Tricks on Developing using Crystal Reports</subtitle><id>http://vstoolsforum.com/blogs/crystal_reports/atom.aspx</id><link rel="alternate" type="text/html" href="http://vstoolsforum.com/blogs/crystal_reports/default.aspx" /><link rel="self" type="application/atom+xml" href="http://vstoolsforum.com/blogs/crystal_reports/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20611.960">Community Server</generator><updated>2007-12-12T15:23:00Z</updated><entry><title>VS 2008 Changing a datasource at runtime</title><link rel="alternate" type="text/html" href="http://vstoolsforum.com/blogs/crystal_reports/archive/2009/04/07/vs-2008-changing-a-datasource-at-runtime.aspx" /><id>http://vstoolsforum.com/blogs/crystal_reports/archive/2009/04/07/vs-2008-changing-a-datasource-at-runtime.aspx</id><published>2009-04-07T16:46:00Z</published><updated>2009-04-07T16:46:00Z</updated><content type="html">&lt;p&gt;This is a walk through for changing the datasource of a VS 2008 Crystal Report at runtime. &lt;/p&gt;
&lt;p&gt;Create a new form in VB, add the Crystal Report Viewer control, dock it. For the sake of simplicity, I&amp;#39;ve kept the code as concise as possible. The form has two public properties, the report name and the data source. We pass those in before opening the form. &lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Imports&lt;/span&gt; Microsoft.VisualBasic
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Imports&lt;/span&gt; System
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Imports&lt;/span&gt; System.Drawing
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Imports&lt;/span&gt; System.Windows.Forms


&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Public&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Class&lt;/span&gt; ReportCrystal
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Dim&lt;/span&gt; crDoc &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;New&lt;/span&gt; CrystalDecisions.CrystalReports.Engine.ReportDocument


    &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;'public variables&lt;/span&gt;
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Public&lt;/span&gt; ReportName &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;String&lt;/span&gt;
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Public&lt;/span&gt; ReportDataTable &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; DataTable



    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Private&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Sub&lt;/span&gt; ReportCrystal_Load(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Object&lt;/span&gt;, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Handles&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.Load
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Dim&lt;/span&gt; strStartupPath &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;String&lt;/span&gt; &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; Application.StartupPath
        strStartupPath += &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"\reports\"&lt;/span&gt; &amp;amp; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.ReportName
        crDoc.Load(strStartupPath)
        crDoc.SetDataSource(ReportDataTable)
        &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.CrystalReportViewer1.ReportSource &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; crDoc
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;End&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Sub&lt;/span&gt;
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;End&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So, the report is called like this. Naturally there will be parameters, but that is not covered here. &lt;/p&gt;
&lt;p&gt;&lt;pre style="overflow: scroll; background-color: #f2f2f2;"&gt;&lt;span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Private&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Sub&lt;/span&gt; btnPrintTickets_Click(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ByVal&lt;/span&gt; sender &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; System.&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Object&lt;/span&gt;, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;ByVal&lt;/span&gt; e &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; System.EventArgs) &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Handles&lt;/span&gt; btnPrintTickets.Click
    &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Dim&lt;/span&gt; frm &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;As&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;New&lt;/span&gt; ReportCrystal


    frm.ReportName &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;"PickingTickets.rpt"&lt;/span&gt;
    &lt;span style="color: Green;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;'code to populate a datatable. This code uses my custom data access classes, but any data access code will do. &lt;/span&gt;
    frm.ReportDataTable &lt;span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;=&lt;/span&gt; SPs.sp_SOP10200_SEL_bySopnumbe(&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.Orders, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.txtPalletID.Text, &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Me&lt;/span&gt;.chkOptimize.Checked, AppUser.Database).getTable


    frm.ShowDialog()
&lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;End&lt;/span&gt; &lt;span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;"&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/p&gt;&lt;img src="http://vstoolsforum.com/aggbug.aspx?PostID=1730" width="1" height="1"&gt;</content><author><name>Steve Gray</name><uri>http://vstoolsforum.com/members/Steve-Gray.aspx</uri></author></entry><entry><title>'CrystalReportViewer' is ambiguous in the namespace 'CrystalDecisions.Web'</title><link rel="alternate" type="text/html" href="http://vstoolsforum.com/blogs/crystal_reports/archive/2008/06/23/crystalreportviewer-is-ambiguous-in-the-namespace-crystaldecisions-web.aspx" /><id>http://vstoolsforum.com/blogs/crystal_reports/archive/2008/06/23/crystalreportviewer-is-ambiguous-in-the-namespace-crystaldecisions-web.aspx</id><published>2008-06-23T16:14:00Z</published><updated>2008-06-23T16:14:00Z</updated><content type="html">&lt;p&gt;Also:&lt;/p&gt;
&lt;p&gt;Error&amp;nbsp;13&amp;nbsp;&amp;#39;ReportDocument&amp;#39; is ambiguous in the namespace &amp;#39;CrystalDecisions.CrystalReports.Engine&amp;#39;.&amp;nbsp;C:\projects\Culinart\Culinart\Reports\POSCash.aspx.vb&amp;nbsp;11&amp;nbsp;18&amp;nbsp;C:\...\Culinart\&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Error&amp;nbsp;15&amp;nbsp;&amp;#39;DiskFileDestinationOptions&amp;#39; is ambiguous in the namespace &amp;#39;CrystalDecisions.Shared&amp;#39;.&amp;nbsp;C:\projects\Culinart\Culinart\Reports\POSCash.aspx.vb&amp;nbsp;47&amp;nbsp;26&amp;nbsp;C:\...\Culinart\&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Error&amp;nbsp;16&amp;nbsp;&amp;#39;ExportDestinationType&amp;#39; is ambiguous in the namespace &amp;#39;CrystalDecisions.Shared&amp;#39;.&amp;nbsp;C:\projects\Culinart\Culinart\Reports\POSCash.aspx.vb&amp;nbsp;50&amp;nbsp;57&amp;nbsp;C:\...\Culinart\&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Error&amp;nbsp;17&amp;nbsp;&amp;#39;ExportFormatType&amp;#39; is ambiguous in the namespace &amp;#39;CrystalDecisions.Shared&amp;#39;.&amp;nbsp;C:\projects\Culinart\Culinart\Reports\POSCash.aspx.vb&amp;nbsp;51&amp;nbsp;52&amp;nbsp;C:\...\Culinart\&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I solved this by going to Project Propertities &amp;gt; References, somehow I had references to two different versions of crystal in my project. While doing this I noticed that the references kept coming back. I searched the project and found that I had double lines iin the web config to different versions of Crystal. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://vstoolsforum.com/aggbug.aspx?PostID=1093" width="1" height="1"&gt;</content><author><name>Steve Gray</name><uri>http://vstoolsforum.com/members/Steve-Gray.aspx</uri></author></entry><entry><title>Crystal in VB Deployment Projects (Visual Studio 2008)</title><link rel="alternate" type="text/html" href="http://vstoolsforum.com/blogs/crystal_reports/archive/2007/12/12/crystal-in-vb-deployment-projects-visual-studio-2008.aspx" /><id>http://vstoolsforum.com/blogs/crystal_reports/archive/2007/12/12/crystal-in-vb-deployment-projects-visual-studio-2008.aspx</id><published>2007-12-12T20:23:00Z</published><updated>2007-12-12T20:23:00Z</updated><content type="html">&lt;p&gt;In Visual Studio 2008, merge modules are no longer used for crystal reports controls.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;To add the crystal reports files:&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp; Go to the deployment project&amp;#39;s properties page.&lt;br /&gt;2.&amp;nbsp; Click the &amp;quot;Prerequisites&amp;quot; button.&lt;br /&gt;3.&amp;nbsp; Add the &amp;quot;Crystal Reports Basic for Visual Studio 2008&amp;quot;&lt;/p&gt;
&lt;p&gt;It may also require the &amp;quot;Windows Installer 3.1&amp;quot;&lt;/p&gt;&lt;img src="http://vstoolsforum.com/aggbug.aspx?PostID=766" width="1" height="1"&gt;</content><author><name>steve gray</name><uri>http://vstoolsforum.com/members/steve-gray.aspx</uri></author></entry></feed>