• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

passing of value from combobox to crreport

hi experts
i am new to the crystal reports , i had taken two combo boxes and a button on a form onclicking that button i should go to another form where i kept the crystalviewer.i want to get the values from the combo boxes and display on my crystal report.
thanks in advance
0
Olivetech
Asked:
Olivetech
1 Solution
 
Brian CroweDatabase AdministratorCommented:
Are you trying to use the combobox values as parameters or just to fill in text fields?  Do you need to know how to get the values to your crystalviewer form or have you already got that covered?
0
 
planoczCommented:
You have to pass your values to the CR report thru parameters that you have setup on the CR report side.

sample for datea and a ID ....

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared

    Public myReport As New ReportDocument        'Gobal Report Doc

    Private Sub Parmas(ByVal myReport)
        ' Objects used to set the parameters in the report
        Dim pvCollection As New ParameterValues
        Dim pdvID As New ParameterDiscreteValue
        Dim pdvStartName As New ParameterDiscreteValue
        Dim pdvEndName As New ParameterDiscreteValue

        Try
            '********************************* ID **********************************
            ' Set the discreet value to the Start Date.
            pdvID.Value = sID
            ' Add it to the parameter collection.
            pvCollection.Add(pdvID)
            ' Apply the current parameter values.
            myReport.DataDefinition.ParameterFields("Id").ApplyCurrentValues(pvCollection)    'Id <---Name on the CR report

            '********************************* Start Date **********************************
            pdvStartName.Value = sDBStartDate
            pvCollection.Add(pdvStartName)
            myReport.DataDefinition.ParameterFields("Start Date").ApplyCurrentValues(pvCollection)

            '********************************* End Date **********************************
            pdvEndName.Value = sDBEndDate
            pvCollection.Add(pdvEndName)
            myReport.DataDefinition.ParameterFields("End Date").ApplyCurrentValues(pvCollection)
        Catch Exp As ParameterFieldException
            MsgBox("Incorrect Parameter Field." & vbNewLine & "In Parmas Procedure Code", _
                    MsgBoxStyle.Critical, "Load Report Error")
        Catch Exp As InvalidArgumentException
            MsgBox(Exp.Message & vbNewLine & "In Parmas Procedure Code", MsgBoxStyle.Critical, "General Error")
        Catch Exp As Exception
            MsgBox(Exp.Message & vbNewLine & "In Parmas Procedure Code", MsgBoxStyle.Critical, "General Error")
        End Try
    End Sub
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now