Print Page | Close Window

Opening a subreport VS2008 C#

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=10967
Printed Date: 19 May 2024 at 2:08pm


Topic: Opening a subreport VS2008 C#
Posted By: andrevh
Subject: Opening a subreport VS2008 C#
Date Posted: 26 Aug 2010 at 5:00am
Hi
 
I have created a subreport in a main report and run it using.
1)  crep = new CrystalReport1();
2)  crep.Load();
3) crep.SetDataSource((System.Data.DataTable)dt); // Filled table
if I use
4)  crep3 = (CrystalReport3)crep.OpenSubreport("Subreport1")
   the function returns null.
I want to do a load and setdatasource on CRep3 afterwards.
 
Why would it return null and what can I do to get a valid object.?
 
 



Replies:
Posted By: BrianBischof
Date Posted: 01 Sep 2010 at 8:55am
Here is a code snippet that I'm using in my current app:

AnimalReport.Subreports["AnimalDetails"].SetDataSource(AnimalDataView);



-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>



Print Page | Close Window