Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Error while passing variable from windows form to Post Reply Post New Topic
Author Message
aurangzeb
Newbie
Newbie


Joined: 08 Oct 2011
Location: Pakistan
Online Status: Offline
Posts: 2
Quote aurangzeb Replybullet Topic: Error while passing variable from windows form to
    Posted: 09 Oct 2011 at 3:25am
I am facing problem i just want to pass parameter from windows form (VB.net) to crystal report so that filtered result can be obtained. I am following the book "Professional Crystal Reports®
for Visual Studio®.NET".

Following are the two error which i am facing.
Please help me where i am wrong? or tell me complete procedure that how to achieve this task or any reference or video tutorial

______________
First Error
------------
'ParameterValues' is not defined.     K:\yasir clinic\success\9 crystal parameters\8 crystal parameters\7 crystal report\WindowsApplication1\WindowsApplication1\Form1.vb      
______________
Second Error
--------------

'ParameterDiscreteValue' is not defined.     K:\yasir clinic\success\9 crystal parameters\8 crystal parameters\7 crystal report\WindowsApplication1\WindowsApplication1\Form1.vb      

_____
code
____

Imports CrystalDecisions.CrystalReports.Engine
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
        Dim cryRpt As New ReportDocument
        cryRpt.Load("K:\yasir clinic\success\7 crystal report\WindowsApplication1\WindowsApplication1\CrystalReport1.rpt")

        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues()
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        crParameterDiscreteValue.Value = Convert.ToInt32(TextBox1.Text)

        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("CrysVisitId")
        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)



        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load



    End Sub

    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

    End Sub

    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    End Sub
End Class
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.031 seconds.