Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 June 7th, 2005, 11:36 AM
Registered User
 
Join Date: Jun 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Crystal Report Parameter

New to VB.Net, long time programmer.

I have a newly created VB.Net application running just fine and adding some reports. All is going well with instantiating the reports and manipulating the form holding the report object. However, I have one report that requires a few fields containing values that are a bit too complex for Crystal to calculate. I have a Public Sub that performs the calculations prior to running the report and want to either:

1) Pass the values into the report WITHOUT the user getting prompted for the parameter values (remember, I've already calculated these values, the user want to see them in the report)
 - Or -
2) Set the values programmatically prior to making the report visible.

I set up a parameter named OpenBalance and tried the following code:

lfOpenBalnce = GetOpenBalance()
oReport.SetParameterValue("OpenBalance", lfOpenBalance)

but Crystal always prompts the user for the OpenBalance value. Any help is appreciated.
 
Old June 13th, 2005, 09:47 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default

On a crystalreportviewer control, one of the properties relates to prompting for parameters; just set this to false.

What I'd recommend, and what I've done, is that get the data using your own code (the following is from a middle-tier 'reports' class I wrote)

Code:
    Public Function PalletList(ByVal JobNumber As String, ByVal DespatchOrOutwork As Char, _
        Optional ByVal Undelivered As Boolean = False) As crPalletList
        ' get the data for the report...
        Dim dsPallets As dsDespatch = oDbOps.GetPalletList(JobNumber, DespatchOrOutwork, Undelivered) ' this goes to a separate 'data access object'

        Dim rptPalletList As New crPalletList ' our crystal report
        rptPalletList.SetDataSource(dsPallets)

        ' return the data for the report...
        Return rptPalletList ' return the report to the client
    End Function
Then in the presentation tier code you just do something like:

Code:
Dim report As crPalletList = objReports.PalletList(JobNumber, DespatchOrOutwork, Undelivered) ' this creates a crPalletList object, a child of the crystal 'ReportClass
fReport.crvReport.ReportSource = report 'fReport is a form, crvReport is a CrystalReportViewer





Similar Threads
Thread Thread Starter Forum Replies Last Post
pass parameter in crystal report srivigdev C# 3 April 14th, 2008 12:11 PM
crystal report parameter sportforever Crystal Reports 4 April 10th, 2008 03:32 AM
crystal report parameter angelboy C# 2005 2 April 22nd, 2007 07:59 AM
Crystal Report Parameter sujah.s ASP.NET 1.0 and 1.1 Basics 0 May 29th, 2006 04:59 AM
Crystal report, passing parameter suni_kutty Crystal Reports 2 October 7th, 2004 03:13 AM





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