none
vb.net reportviewer parameters RRS feed

  • Question

  • HI

     

    I  tried to use the samples in www.gotreportviewer.com and others c# samples in msnd, but don´t work.

     

    Anyone have a sample that show how can I pass the parameters to Reportviewer  in VB.NET?

     

    Thanks 

     

    Nelson de Moura

    Saturday, May 12, 2007 8:00 PM

All replies

  • To passthem into the report viewer from another vb form do the following

    Code Snippet



    Imports microsoft.Reporting.WinForms
    ......

    'I have two parameters in my report object "StartDate" 'and "EndDate" -- date type


            Dim sDate As New ReportParameter("StartDate", CType("1/1/07", Date))
            Dim eDate As New ReportParameter("EndDate", CType("5/5/07", Date))

            Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {sDate, eDate})
            Me.ReportViewer1.RefreshReport()




    I'm still trying to find a way to pass parameters from the report it's self to the stored procedures within it.
    Thursday, May 31, 2007 1:16 PM
  • Create a list of reportparameters and add your parameter to it.

     

    pass the list to the setParameters method.

     

    i.e

     

    dim myparam as new reportparameter("p1,"12345")

    dim myparams as new list (of reportparameter)

    myparams.add(myparam)

    me.reportviewer1.localreport.setparameters(myparams)

     

     

    JC

     

    Friday, December 14, 2007 1:40 PM