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. How to pass parameters to subreport frm vb.net code?

How to pass parameters to subreport frm vb.net code?

Scheduled Pinned Locked Moved Visual Basic
csharpwinformstutorialquestion
2 Posts 2 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.
  • P Offline
    P Offline
    priya_p233
    wrote on last edited by
    #1

    hi, i m calling crystal report frm my vb.net(winforms) form. my report contains 1 subreport & both main & sub report contains the parameter, on which record selection depends. it is ok with my code to pass value to main report. but tell me please how to pass parameter value to subreport? i m passing parameter values by following code-? Dim myReport1 As New CRptTimesheetPerEmp Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldDefinition As ParameterFieldDefinition Dim crParameterValues As New ParameterValues() Dim crParameterDiscreteValue As New ParameterDiscreteValue() crParameterDiscreteValue.Value = frmTimeSheetRpt1.cmbEmpId.Text crParameterFieldDefinitions = myReport1.DataDefinition.ParameterFields crParameterFieldDefinition = crParameterFieldDefinitions.Item(0) crParameterValues = crParameterFieldDefinition.CurrentValues crParameterValues.Clear() crParameterValues.Add(crParameterDiscreteValue) crParameterFieldDefinition.ApplyCurrentValues(crParameterValues) CrystRptVEmpTimeSheet.ReportSource = myReport1

    "The Difficult i can do it now... The Impossible will take a little longer."

    D 1 Reply Last reply
    0
    • P priya_p233

      hi, i m calling crystal report frm my vb.net(winforms) form. my report contains 1 subreport & both main & sub report contains the parameter, on which record selection depends. it is ok with my code to pass value to main report. but tell me please how to pass parameter value to subreport? i m passing parameter values by following code-? Dim myReport1 As New CRptTimesheetPerEmp Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldDefinition As ParameterFieldDefinition Dim crParameterValues As New ParameterValues() Dim crParameterDiscreteValue As New ParameterDiscreteValue() crParameterDiscreteValue.Value = frmTimeSheetRpt1.cmbEmpId.Text crParameterFieldDefinitions = myReport1.DataDefinition.ParameterFields crParameterFieldDefinition = crParameterFieldDefinitions.Item(0) crParameterValues = crParameterFieldDefinition.CurrentValues crParameterValues.Clear() crParameterValues.Add(crParameterDiscreteValue) crParameterFieldDefinition.ApplyCurrentValues(crParameterValues) CrystRptVEmpTimeSheet.ReportSource = myReport1

      "The Difficult i can do it now... The Impossible will take a little longer."

      D Offline
      D Offline
      dotnet_lover
      wrote on last edited by
      #2

      its easy to set parameter in the crystal report rather than passing the parameter to subreport through coding jus try this first take a parameter as a field in the crystal subreport and link the subreport to the original report u can simply do that by right clicking on a subreport and establish a link

      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