Passing Paramaters with VB to Crystal Reports
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 4 of 4

Thread: Passing Paramaters with VB to Crystal Reports

  1. #1
    Join Date
    Apr 2011

    Passing Paramaters with VB to Crystal Reports

    Hi Guys,

    Im new to this forum, and I hope some one can help me.

    I have a situation where I need to programatically pass paramaters using VB through to my crystal report. I am using Visual Studio 2008 for my development.

    Everything is working fine, but when I run the report I get a "Value cannot be Null" error. this is in the Crystal Reports Rorm Viewer.

    My complete code is below.


    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports System.Data.OleDb

    Public Class Form1

    Private Sub CrystalReport11_InitReport(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReport11.InitReport

    Dim CR As New ReportDocument

    Dim crParameterDiscreteValue As ParameterDiscreteValue

    Dim crParameterFieldDefinitions As ParameterFieldDefinitions

    Dim crParameterFieldLocation As ParameterFieldDefinition

    Dim crParameterValues As ParameterValues

    crParameterFieldDefinitions = CR.DataDefinition.ParameterFields

    crParameterFieldLocation = crParameterFieldDefinitions.Item("@ParameterName1")

    crParameterValues = crParameterFieldLocation.CurrentValues

    crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue

    crParameterDiscreteValue.Value = "test"



    CrystalReportViewer1.ReportSource = CR

    End Sub

    End Class


    As I said my paramater is passed and displayed on the report, but I keep getting this error...

    can anyone help.

  2. #2
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: Passing Paramaters with VB to Crystal Reports

    Fix your code. Add [] [/] with Code before the ]

    ' This is code

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2011

    Re: Passing Paramaters with VB to Crystal Reports

    I dont understand fix your code?

    is it not readable?

  4. #4
    Join Date
    Jul 2001
    Sunny South Africa

    Re: Passing Paramaters with VB to Crystal Reports

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center