Print Page | Close Window

Passing parameter from windows form to Report

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3039
Printed Date: 29 Mar 2024 at 4:02am


Topic: Passing parameter from windows form to Report
Posted By: ibanez335
Subject: Passing parameter from windows form to Report
Date Posted: 26 Apr 2008 at 11:13am
Hi Everyone, this is my first post so I hope I don't breach any of the rules.  I am a recent convert from VB6 to VB2005 studio bundled with CRXI.  I have a windows form with a datagridview linked to an access database.  By clicking on the dgv a single record is displayed in textboxes on the form.  I simply want to copy the textboxes directly to a report using a button. 
I've just got a copy of CR.net programming and I'm wandering whether to just use the primary key displayed on the form as the equivalent of a parameter query for the report - I think chapter 16 might help.
 
Can anyone suggest the best way for me to go?
 
Thanks in advance,
 
Alan
 
p.s. the book lokks just what I was looking for.



Replies:
Posted By: BrianBischof
Date Posted: 26 Apr 2008 at 12:02pm
Thanks for getting the book! Since you are using CR.NET 2005, please remember that the book is for CR.NET 2003 and the 2005 version has better datasets (faster) and that in ASP.NET you can only use the Load() method to load a report into the ReportDocument object. Also, it is MUCH easier to change parameters using the SetParameterValue() method. The code in the book is only necessary for 2003.

For this report, I would use the primary key of the row that was selected in the grid and pass that as a parameter to the report to be used in the record selection formula. Also, it is easy to manually override the record selection formula and hardcode the primary key into the formula.


-------------
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>


Posted By: ibanez335
Date Posted: 26 Apr 2008 at 3:31pm
Thanks for the swift reply Brian,
 
I'll give it a try



Print Page | Close Window