Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 6th, 2007, 06:59 AM
Registered User
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default two reports in one CrystalReportViewer

hi to All....

Can anybody help me?

I want two reports (with two parmeters @p1 and @p2) in one CrystalReportViewer...

But I don't understand my mistake:

Dim prF As New ParameterField
Dim prFs As New ParameterFields
Dim rangeval As New ParameterRangeValue

prF = New ParameterField
prF.Name = "@city_name"

rangeval.StartValue = ListBox1.Items.Item(0) 'parameter @p1
rangeval.EndValue = ListBox1.Items.Item(1) 'parameter @p2

CrystalReportViewer1.ParameterFieldInfo = prFs
CrystalReportViewer1.ReportSource = myCrysReport

Gratitude to all answered

Old August 6th, 2007, 08:49 AM
Registered User
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dineshkrishna108 Send a message via Yahoo to dineshkrishna108

              First of all know one thing, u cannot display 2 reports in a single report viewer simultaneously.U can have 2 different buttons for 2 reports. upon cliking button u can passs the corresponding dataset itself to the form containing reportviewer and assign that dataset to report document object.Just follow this example...Ensure that u have included the namespace;

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

//put the following in ur form load or button clik event

   DateTime StartDate = StartDateTimePicker.Value;//combobox's value
   DateTime EndDate = EndDateTimePicker.Value;//combobox's value

       ReportDocument cr = new ReportDocument();
         //' stored procedure direct in the report.
      cr.Load("CrystalReportTesting.rpt"); //ensure u keep this report in the project directory
         //' Set CrystalReportViewer.ReportSource
         crystalReportViewer1.ReportSource = cr;
ParameterField field1 = this.crystalReportViewer1.ParameterFieldInfo[0];//u can give parameter name in quotes or simply mention index like this.
ParameterField field2 = this.crystalReportViewer1.ParameterFieldInfo[1];//u can give parameter name in quotes or simply mention index like this.

 ParameterDiscreteValue val1 = new ParameterDiscreteValue();
 ParameterDiscreteValue val2 = new ParameterDiscreteValue();
               val1.Value = StartDate;
               val2.Value = EndDate;
Hope this meets u well..

Old August 7th, 2007, 12:29 AM
Registered User
Join Date: Aug 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

A lot of thanks to your answer, dinesh.....
I shall try...

Similar Threads
Thread Thread Starter Forum Replies Last Post
Paging in CrystalReportViewer rakeshvc Crystal Reports 1 May 19th, 2014 06:18 AM
mousewheel on crystalreportviewer SabinoFonseca VB.NET 2002/2003 Basics 1 October 10th, 2007 12:34 PM
There is no toolbar in crystalreportviewer basith7861 VB.NET 2002/2003 Basics 1 May 1st, 2007 10:24 PM
Optimizing CrystalReportViewer imcoolanytime Crystal Reports 0 February 6th, 2006 11:15 AM
crystalreportviewer and paging vinki General .NET 0 December 10th, 2004 08:33 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.