Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Preview Crystal Report on Windows Form in C# Post Reply Post New Topic
Author Message
koncuk
Newbie
Newbie


Joined: 03 Sep 2009
Online Status: Offline
Posts: 17
Quote koncuk Replybullet Topic: Preview Crystal Report on Windows Form in C#
    Posted: 10 Dec 2009 at 4:49am
There is a button on a windows form called Print the Report. It should show a report as a new form on the screen if I use the button.

I have created a new form and added crystalviewer but I don’t have any code. I have defined the reportsource.

Which code should I write in click option of the button.

Thanks for your help.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 10 Dec 2009 at 10:36am

If all you need to do is open the form to show the report, you just need to .show() the new form.

If you want to make the form generic so that it can show different reports or so that you can set parameters or if you need to use a DataSet from your application, here's what I do:
 
1.  Override the constructor for the new form to add parameters for the report name or type, DataSet, and/or report parameters.
 
2.  In the overridden constructor, set the various properties for the requested report.
 
I have sample code for something similar to this on my website - www.geocities.com/geekgurl7/sample_code.html.  Look for the BOEUserAudit application in about the middle of the page.
 
-Dell
IP IP Logged
koncuk
Newbie
Newbie


Joined: 03 Sep 2009
Online Status: Offline
Posts: 17
Quote koncuk Replybullet Posted: 11 Dec 2009 at 2:39am
thank you so much your helping,

I wanted to show the report as a form.
I like your opinions so I have finded your web side downloaded the link but it doesn't work.

And also I want to do this;
The report will show on screen and there will be a button on it. It should send to printer the report when I click the button .

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 11 Dec 2009 at 7:16am
The Crystal Viewer component has a print button, so you shouldn't have to specifically program one.
 
If you're trying to compile my code, it needs the full BusinessObjects Enterprise SDK, which you probably don't have.  However, you can use the code in BOEAuditRptViewer.cs as an example of how to set up your viewer form, modifying it for your own needs.  The code to call the form is in the RunReport method in BOEUserAuditForm.cs.
 
Basically, you have to create the viewer form and then .Show() it.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.