Print Page | Close Window

Call C# class from Crystal Report

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=4072
Printed Date: 28 Apr 2024 at 11:29pm


Topic: Call C# class from Crystal Report
Posted By: holzert
Subject: Call C# class from Crystal Report
Date Posted: 24 Aug 2008 at 2:20pm

Can I create a utility class in C# VS2008 and call it from the report? 

We have some reports that currently call a common function in a prg in VFP.  We are rewriting in C# and using Crystal Reports.  We would like to change that to a VS2008  class called from many Crystal reports…

Is this possible?  If so, does the class have to exist in the same assembly?




Replies:
Posted By: hilfy
Date Posted: 09 Sep 2008 at 4:14pm
I haven't tried this, but I found this link
 
http://msdn.microsoft.com/en-us/library/ms227603.aspx - http://msdn.microsoft.com/en-us/library/ms227603.aspx
 
using a Google search on crystal report user function library C#.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: holzert
Date Posted: 09 Sep 2008 at 4:39pm
Thanks.  I should have posted earlier.  I had found that as well but I disregarded it because I found it that the classes are only available via com interop...
 
Thanks!  It will be nice to have that available for lurkers...
 
Tch


Posted By: hilfy
Date Posted: 10 Sep 2008 at 6:59am
Yeah...COM....yuck.  However, ALL of the Crystal and BusinessObjects .NET classes are just wrappers for the underlying COM classes.  So, even when you're not building a UFL, if you're using Crystal, you're using COM. 
 
FYI, because .NET is not very good at garbage collecting with COM objects, you need to be sure to either wrap your calls to the Crystal classes in "Using" clauses or explicitly call .Dispose() on the object when you're finished with it.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: holzert
Date Posted: 10 Sep 2008 at 9:42am

Thanks!




Print Page | Close Window