Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.Net - Crystal report direct to printer. Missing parameter values [modified]

VB.Net - Crystal report direct to printer. Missing parameter values [modified]

Scheduled Pinned Locked Moved Visual Basic
csharphelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Central_IT
    wrote on last edited by
    #1

    I am getting the following error message "Missing parameter values." when I am trying to print directly to the printer. Below is my code. Works perfect if I want to view on screen but get the above error message when I try to print direct to my printer. If I did not have any parameter code etc, prints no bother to printer. Dim cr As New ReportDocument Dim param1Fields As New ParameterFields Dim param1Field As New ParameterField Dim param1Range As New ParameterDiscreteValue cr.Load("c:\MyReport.rpt") param1Field.ParameterFieldName = "PassedParameter" param1Range.Value = 123456 param1Field.CurrentValues.Add(param1Range) param1Fields.Add(param1Field) CrystalReportViewer1.ParameterFieldInfo = param1Fields 'View Report 'CrystalReportViewer1.ReportSource = cr 'Print straight to printer cr.PrintToPrinter(1, False, 0, 0) '(1, False, 0, 0)

    modified on Friday, November 26, 2010 5:21 AM

    C 1 Reply Last reply
    0
    • C Central_IT

      I am getting the following error message "Missing parameter values." when I am trying to print directly to the printer. Below is my code. Works perfect if I want to view on screen but get the above error message when I try to print direct to my printer. If I did not have any parameter code etc, prints no bother to printer. Dim cr As New ReportDocument Dim param1Fields As New ParameterFields Dim param1Field As New ParameterField Dim param1Range As New ParameterDiscreteValue cr.Load("c:\MyReport.rpt") param1Field.ParameterFieldName = "PassedParameter" param1Range.Value = 123456 param1Field.CurrentValues.Add(param1Range) param1Fields.Add(param1Field) CrystalReportViewer1.ParameterFieldInfo = param1Fields 'View Report 'CrystalReportViewer1.ReportSource = cr 'Print straight to printer cr.PrintToPrinter(1, False, 0, 0) '(1, False, 0, 0)

      modified on Friday, November 26, 2010 5:21 AM

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #2

      IS_Assessor wrote:

      CrystalReportViewer1.ParameterFieldInfo = param1Fields

      I suspect your problem is here - you are assigning the parameter to the Viewer object, not the report document.

      C 1 Reply Last reply
      0
      • C ChandraRam

        IS_Assessor wrote:

        CrystalReportViewer1.ParameterFieldInfo = param1Fields

        I suspect your problem is here - you are assigning the parameter to the Viewer object, not the report document.

        C Offline
        C Offline
        Central_IT
        wrote on last edited by
        #3

        Hi, Thanks for replying. I tried the following but still got the same message. cr.DataDefinition.ParameterFields("PassParameter").ApplyCurrentValues("123456") I agree I was assigning the parameter to the viewer object but I just cannot seem to get the syntax right to assign to cr. What is the correct syntax as I have tried all sorts code?

        D 1 Reply Last reply
        0
        • C Central_IT

          Hi, Thanks for replying. I tried the following but still got the same message. cr.DataDefinition.ParameterFields("PassParameter").ApplyCurrentValues("123456") I agree I was assigning the parameter to the viewer object but I just cannot seem to get the syntax right to assign to cr. What is the correct syntax as I have tried all sorts code?

          D Offline
          D Offline
          DJ Matthews
          wrote on last edited by
          #4

          try this:

          crReportDocument.SetParameterValue(ParameterName, Value)

          C 1 Reply Last reply
          0
          • D DJ Matthews

            try this:

            crReportDocument.SetParameterValue(ParameterName, Value)

            C Offline
            C Offline
            Central_IT
            wrote on last edited by
            #5

            Works a treat now. A big thank you and have a great weekend.

            H 1 Reply Last reply
            0
            • C Central_IT

              Works a treat now. A big thank you and have a great weekend.

              H Offline
              H Offline
              Henry Minute
              wrote on last edited by
              #6

              Central_IT wrote:

              Works a treat now. A big thank you and have a great weekend.

              If you are that pleased then at least have the courtesy to give the guy a 5 vote!

              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups