How is it possible ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alison Givens

    #1

    How is it possible ...

    ....... that nobody knows the answer.
    I can't imagine that I am the only one that uses parameters in CR.

    So, my question again:

    I have the following problem.
    (VB.NET 2003 with CR)

    I have a report with a multiple-value discrete value and a rangevalue.
    The report shows fine in the viewer, but when I hit the export to pdf
    button, it only uses one of two discrete values.

    This is the code:
    Dim BeginPeriode As String
    Dim EindPeriode As String

    BeginPeriode = Request.QuerySt ring("BeginPeri ode")
    EindPeriode = Request.QuerySt ring("EindPerio de")

    Dim myReport As New RapportAIRCOSto ringen

    Dim paramFields As New ParameterFields
    Dim paramField As New ParameterField
    Dim discreteVal As New ParameterDiscre teValue
    Dim rangeVal As New ParameterRangeV alue

    paramField.Para meterFieldName = "FiliaalKeu ze"
    discreteVal.Val ue = "2044"
    paramField.Curr entValues.Add(d iscreteVal)

    discreteVal = New ParameterDiscre teValue
    discreteVal.Val ue = "2344"
    paramField.Curr entValues.Add(d iscreteVal)

    paramFields.Add (paramField)

    paramField = New ParameterField

    paramField.Para meterFieldName = "Periode"

    rangeVal.StartV alue = BeginPeriode
    rangeVal.EndVal ue = EindPeriode
    paramField.Curr entValues.Add(r angeVal)

    paramFields.Add (paramField)

    crViewer.Parame terFieldInfo = paramFields
    myReport.SetPar ameterValue("Pe riode", rangeVal)
    myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
    crViewer.Report Source = myReport

    As you can see I use myReport.SetPar ameterValue to feed the pdf.
    It goes wrong with the discrete value. It only sees the second value I
    entered and not the first.
    How can I get this going?


    Kind regards,
    Alison




  • AMDRIT

    #2
    Re: How is it possible ...

    Wow, you do all that for Crystal Reports? What is RapportAIRCOSto ringen?


    Here is all I do for CR

    Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document

    x.Load(sReportP ath)
    'Reports are not embedded resources
    x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic Paramaters
    x.SetParameterV alue("Paramater 2", Paramaters(2))
    x.SetDataSource (mydata) 'Strongly
    Typed Datasets

    Me.CrystalRepor tViewer1.Report Source = x
    Me.CrystalRepor tViewer1.PrintR eport()


    'Now to answer your question about your code, hmm

    Ok, first

    Never --> Dim x as new object
    'This is silly, lazy and unprofessional. So if you are in high
    school, keep the course.


    Instead --> Dim x as object
    Set x = new object
    'Reserve your space and contract
    'Then make use of it.

    I think this is your problem

    myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)

    Why are you setting the crView paramaters and the myReport paramaters?
    -->crViewer.Param eterFieldInfo = paramFields
    -->myReport.SetPa rameterValue("P eriode", rangeVal)

    I think that myReport is the only think that needs to be set


    I had to spent time reading your code to understand what you were doing.

    Here is an attempt to clean it up.

    Private Sub TestIT()

    Dim myReport As RapportAIRCOSto ringen
    Dim paramFields As ParameterFields
    Dim paramField As ParameterField

    Dim BeginPeriode As String
    Dim EindPeriode As String

    'Todo wrap everything in try
    paramFields = New ParameterFields

    Try
    BeginPeriode = Request.QuerySt ring("BeginPeri ode")
    EindPeriode = Request.QuerySt ring("EindPerio de")
    Catch ex As Exception
    Dim exCustom As ApplicationExce ption
    exCustom = New ApplicationExce ption("Unable to parse Query
    Paramaters.", ex)
    Throw exCustom
    End Try

    'Todo wrap in try
    paramField = CreateParamater ("FiliaalKeuze" )
    paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
    paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
    myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
    'paramFields.Ad d(paramField) --> Not needed

    'Todo wrap in try
    paramField = CreateParamater ("Periode")
    paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
    EindPeriode))
    myReport.SetPar ameterValue("Pe riode", paramField)
    'paramFields.Ad d(paramField)--> Not needed

    'Todo wrap in try, i don't think you need this
    'myReport.SetPa rameterValue("P eriode", rangeVal)
    'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)

    'Todo, determine if we need this step; I don't think you do
    'crViewer.Param eterFieldInfo = paramFields

    crViewer.Report Source = myReport

    End Sub

    Private Function CreateParamater (ByVal ParamaterName As String) As
    ParameterField
    Dim paramField As ParameterField

    paramField = New ParameterField
    paramField.Para meterFieldName = ParamaterName

    Return paramField

    End Function

    Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
    ParameterDiscre teValue

    Dim paramDiscreteVa lue As ParameterDiscre teValue
    paramDiscreteVa lue = New ParameterDiscre teValue
    paramDiscreteVa lue = Value

    Return paramDiscreteVa lue

    End Function

    Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
    ByVal EndRange As Object) As ParameterRangeV alue
    Dim paramRangeValue As ParameterRangeV alue

    paramRangeValue = New ParameterRangeV alue

    paramRangeValue .StartValue = StartRange
    paramRangeValue .EndValue = EndRange

    Return paramRangeValue
    End Function

    "Alison Givens" <info@cross-it.nl> wrote in message
    news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...[color=blue]
    > ...... that nobody knows the answer.
    > I can't imagine that I am the only one that uses parameters in CR.
    >
    > So, my question again:
    >
    > I have the following problem.
    > (VB.NET 2003 with CR)
    >
    > I have a report with a multiple-value discrete value and a rangevalue.
    > The report shows fine in the viewer, but when I hit the export to pdf
    > button, it only uses one of two discrete values.
    >
    > This is the code:
    > Dim BeginPeriode As String
    > Dim EindPeriode As String
    >
    > BeginPeriode = Request.QuerySt ring("BeginPeri ode")
    > EindPeriode = Request.QuerySt ring("EindPerio de")
    >
    > Dim myReport As New RapportAIRCOSto ringen
    >
    > Dim paramFields As New ParameterFields
    > Dim paramField As New ParameterField
    > Dim discreteVal As New ParameterDiscre teValue
    > Dim rangeVal As New ParameterRangeV alue
    >
    > paramField.Para meterFieldName = "FiliaalKeu ze"
    > discreteVal.Val ue = "2044"
    > paramField.Curr entValues.Add(d iscreteVal)
    >
    > discreteVal = New ParameterDiscre teValue
    > discreteVal.Val ue = "2344"
    > paramField.Curr entValues.Add(d iscreteVal)
    >
    > paramFields.Add (paramField)
    >
    > paramField = New ParameterField
    >
    > paramField.Para meterFieldName = "Periode"
    >
    > rangeVal.StartV alue = BeginPeriode
    > rangeVal.EndVal ue = EindPeriode
    > paramField.Curr entValues.Add(r angeVal)
    >
    > paramFields.Add (paramField)
    >
    > crViewer.Parame terFieldInfo = paramFields
    > myReport.SetPar ameterValue("Pe riode", rangeVal)
    > myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
    > crViewer.Report Source = myReport
    >
    > As you can see I use myReport.SetPar ameterValue to feed the pdf.
    > It goes wrong with the discrete value. It only sees the second value I
    > entered and not the first.
    > How can I get this going?
    >
    >
    > Kind regards,
    > Alison
    >
    >
    >
    >[/color]


    Comment

    • Alison Givens

      #3
      Re: How is it possible ...

      When I use your solution I get blue lines under the text like this

      paramField = CreateParamater ("FiliaalKeuze" )
      The text is:
      Value of type '1 dimensional array of
      CrystalDecision s.Shared.Parame terField' cannot be converted
      to 'Crystal.Decisi ons.Shared.Para meterField'

      Return paramField
      The text is:
      Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be converted
      to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'

      Same for
      paramField = CreateParamater ("Periode")
      Return paramDiscreteVa lue

      Any idea what causes this?

      Alison


      "AMDRIT" <amdrit@hotmail .com> wrote in message
      news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...[color=blue]
      > Wow, you do all that for Crystal Reports? What is RapportAIRCOSto ringen?
      >
      >
      > Here is all I do for CR
      >
      > Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
      >
      > x.Load(sReportP ath) 'Reports are not embedded resources
      > x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic Paramaters
      > x.SetParameterV alue("Paramater 2", Paramaters(2))
      > x.SetDataSource (mydata)
      > 'Strongly Typed Datasets
      >
      > Me.CrystalRepor tViewer1.Report Source = x
      > Me.CrystalRepor tViewer1.PrintR eport()
      >
      >
      > 'Now to answer your question about your code, hmm
      >
      > Ok, first
      >
      > Never --> Dim x as new object
      > 'This is silly, lazy and unprofessional. So if you are in high
      > school, keep the course.
      >
      >
      > Instead --> Dim x as object
      > Set x = new object
      > 'Reserve your space and contract
      > 'Then make use of it.
      >
      > I think this is your problem
      >
      > myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
      >
      > Why are you setting the crView paramaters and the myReport paramaters?
      > -->crViewer.Param eterFieldInfo = paramFields
      > -->myReport.SetPa rameterValue("P eriode", rangeVal)
      >
      > I think that myReport is the only think that needs to be set
      >
      >
      > I had to spent time reading your code to understand what you were doing.
      >
      > Here is an attempt to clean it up.
      >
      > Private Sub TestIT()
      >
      > Dim myReport As RapportAIRCOSto ringen
      > Dim paramFields As ParameterFields
      > Dim paramField As ParameterField
      >
      > Dim BeginPeriode As String
      > Dim EindPeriode As String
      >
      > 'Todo wrap everything in try
      > paramFields = New ParameterFields
      >
      > Try
      > BeginPeriode = Request.QuerySt ring("BeginPeri ode")
      > EindPeriode = Request.QuerySt ring("EindPerio de")
      > Catch ex As Exception
      > Dim exCustom As ApplicationExce ption
      > exCustom = New ApplicationExce ption("Unable to parse Query
      > Paramaters.", ex)
      > Throw exCustom
      > End Try
      >
      > 'Todo wrap in try
      > paramField = CreateParamater ("FiliaalKeuze" )
      > paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
      > paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
      > myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
      > 'paramFields.Ad d(paramField) --> Not needed
      >
      > 'Todo wrap in try
      > paramField = CreateParamater ("Periode")
      > paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
      > EindPeriode))
      > myReport.SetPar ameterValue("Pe riode", paramField)
      > 'paramFields.Ad d(paramField)--> Not needed
      >
      > 'Todo wrap in try, i don't think you need this
      > 'myReport.SetPa rameterValue("P eriode", rangeVal)
      > 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
      >
      > 'Todo, determine if we need this step; I don't think you do
      > 'crViewer.Param eterFieldInfo = paramFields
      >
      > crViewer.Report Source = myReport
      >
      > End Sub
      >
      > Private Function CreateParamater (ByVal ParamaterName As String) As
      > ParameterField
      > Dim paramField As ParameterField
      >
      > paramField = New ParameterField
      > paramField.Para meterFieldName = ParamaterName
      >
      > Return paramField
      >
      > End Function
      >
      > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
      > ParameterDiscre teValue
      >
      > Dim paramDiscreteVa lue As ParameterDiscre teValue
      > paramDiscreteVa lue = New ParameterDiscre teValue
      > paramDiscreteVa lue = Value
      >
      > Return paramDiscreteVa lue
      >
      > End Function
      >
      > Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
      > ByVal EndRange As Object) As ParameterRangeV alue
      > Dim paramRangeValue As ParameterRangeV alue
      >
      > paramRangeValue = New ParameterRangeV alue
      >
      > paramRangeValue .StartValue = StartRange
      > paramRangeValue .EndValue = EndRange
      >
      > Return paramRangeValue
      > End Function
      >
      > "Alison Givens" <info@cross-it.nl> wrote in message
      > news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...[color=green]
      >> ...... that nobody knows the answer.
      >> I can't imagine that I am the only one that uses parameters in CR.
      >>
      >> So, my question again:
      >>
      >> I have the following problem.
      >> (VB.NET 2003 with CR)
      >>
      >> I have a report with a multiple-value discrete value and a rangevalue.
      >> The report shows fine in the viewer, but when I hit the export to pdf
      >> button, it only uses one of two discrete values.
      >>
      >> This is the code:
      >> Dim BeginPeriode As String
      >> Dim EindPeriode As String
      >>
      >> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
      >> EindPeriode = Request.QuerySt ring("EindPerio de")
      >>
      >> Dim myReport As New RapportAIRCOSto ringen
      >>
      >> Dim paramFields As New ParameterFields
      >> Dim paramField As New ParameterField
      >> Dim discreteVal As New ParameterDiscre teValue
      >> Dim rangeVal As New ParameterRangeV alue
      >>
      >> paramField.Para meterFieldName = "FiliaalKeu ze"
      >> discreteVal.Val ue = "2044"
      >> paramField.Curr entValues.Add(d iscreteVal)
      >>
      >> discreteVal = New ParameterDiscre teValue
      >> discreteVal.Val ue = "2344"
      >> paramField.Curr entValues.Add(d iscreteVal)
      >>
      >> paramFields.Add (paramField)
      >>
      >> paramField = New ParameterField
      >>
      >> paramField.Para meterFieldName = "Periode"
      >>
      >> rangeVal.StartV alue = BeginPeriode
      >> rangeVal.EndVal ue = EindPeriode
      >> paramField.Curr entValues.Add(r angeVal)
      >>
      >> paramFields.Add (paramField)
      >>
      >> crViewer.Parame terFieldInfo = paramFields
      >> myReport.SetPar ameterValue("Pe riode", rangeVal)
      >> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
      >> crViewer.Report Source = myReport
      >>
      >> As you can see I use myReport.SetPar ameterValue to feed the pdf.
      >> It goes wrong with the discrete value. It only sees the second value I
      >> entered and not the first.
      >> How can I get this going?
      >>
      >>
      >> Kind regards,
      >> Alison
      >>
      >>
      >>
      >>[/color]
      >
      >[/color]


      Comment

      • AMDRIT

        #4
        Re: How is it possible ...

        All I did was take your code and break it up. I haven't tested the code,
        rather; I was just breaking up your code for readability.

        You had:

        Dim paramField As New ParameterField
        paramField = New ParameterField
        paramField.Para meterFieldName = "Periode"

        I changed to (I don't see a difference):

        paramField = CreateParamater ("Periode")

        Private Function CreateParamater (ByVal ParamaterName As String) As
        ParameterField
        Dim paramField As ParameterField

        paramField = New ParameterField
        paramField.Para meterFieldName = ParamaterName

        Return paramField

        End Function

        Perhaps you could share your resulting code for comparison? Did you see
        that I suggested the error in your code was

        myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call this
        statement once (Effectively 2344) but you wanted two values.


        "Alison Givens" <info@cross-it.nl> wrote in message
        news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...[color=blue]
        > When I use your solution I get blue lines under the text like this
        >
        > paramField = CreateParamater ("FiliaalKeuze" )
        > The text is:
        > Value of type '1 dimensional array of
        > CrystalDecision s.Shared.Parame terField' cannot be converted
        > to 'Crystal.Decisi ons.Shared.Para meterField'
        >
        > Return paramField
        > The text is:
        > Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be converted
        > to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
        >
        > Same for
        > paramField = CreateParamater ("Periode")
        > Return paramDiscreteVa lue
        >
        > Any idea what causes this?
        >
        > Alison
        >
        >
        > "AMDRIT" <amdrit@hotmail .com> wrote in message
        > news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...[color=green]
        >> Wow, you do all that for Crystal Reports? What is RapportAIRCOSto ringen?
        >>
        >>
        >> Here is all I do for CR
        >>
        >> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
        >>
        >> x.Load(sReportP ath) 'Reports are not embedded resources
        >> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic Paramaters
        >> x.SetParameterV alue("Paramater 2", Paramaters(2))
        >> x.SetDataSource (mydata) 'Strongly Typed Datasets
        >>
        >> Me.CrystalRepor tViewer1.Report Source = x
        >> Me.CrystalRepor tViewer1.PrintR eport()
        >>
        >>
        >> 'Now to answer your question about your code, hmm
        >>
        >> Ok, first
        >>
        >> Never --> Dim x as new object
        >> 'This is silly, lazy and unprofessional. So if you are in high
        >> school, keep the course.
        >>
        >>
        >> Instead --> Dim x as object
        >> Set x = new object
        >> 'Reserve your space and contract
        >> 'Then make use of it.
        >>
        >> I think this is your problem
        >>
        >> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
        >>
        >> Why are you setting the crView paramaters and the myReport paramaters?
        >> -->crViewer.Param eterFieldInfo = paramFields
        >> -->myReport.SetPa rameterValue("P eriode", rangeVal)
        >>
        >> I think that myReport is the only think that needs to be set
        >>
        >>
        >> I had to spent time reading your code to understand what you were doing.
        >>
        >> Here is an attempt to clean it up.
        >>
        >> Private Sub TestIT()
        >>
        >> Dim myReport As RapportAIRCOSto ringen
        >> Dim paramFields As ParameterFields
        >> Dim paramField As ParameterField
        >>
        >> Dim BeginPeriode As String
        >> Dim EindPeriode As String
        >>
        >> 'Todo wrap everything in try
        >> paramFields = New ParameterFields
        >>
        >> Try
        >> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
        >> EindPeriode = Request.QuerySt ring("EindPerio de")
        >> Catch ex As Exception
        >> Dim exCustom As ApplicationExce ption
        >> exCustom = New ApplicationExce ption("Unable to parse Query
        >> Paramaters.", ex)
        >> Throw exCustom
        >> End Try
        >>
        >> 'Todo wrap in try
        >> paramField = CreateParamater ("FiliaalKeuze" )
        >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
        >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
        >> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
        >> 'paramFields.Ad d(paramField) --> Not needed
        >>
        >> 'Todo wrap in try
        >> paramField = CreateParamater ("Periode")
        >> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
        >> EindPeriode))
        >> myReport.SetPar ameterValue("Pe riode", paramField)
        >> 'paramFields.Ad d(paramField)--> Not needed
        >>
        >> 'Todo wrap in try, i don't think you need this
        >> 'myReport.SetPa rameterValue("P eriode", rangeVal)
        >> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
        >>
        >> 'Todo, determine if we need this step; I don't think you do
        >> 'crViewer.Param eterFieldInfo = paramFields
        >>
        >> crViewer.Report Source = myReport
        >>
        >> End Sub
        >>
        >> Private Function CreateParamater (ByVal ParamaterName As String) As
        >> ParameterField
        >> Dim paramField As ParameterField
        >>
        >> paramField = New ParameterField
        >> paramField.Para meterFieldName = ParamaterName
        >>
        >> Return paramField
        >>
        >> End Function
        >>
        >> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
        >> ParameterDiscre teValue
        >>
        >> Dim paramDiscreteVa lue As ParameterDiscre teValue
        >> paramDiscreteVa lue = New ParameterDiscre teValue
        >> paramDiscreteVa lue = Value
        >>
        >> Return paramDiscreteVa lue
        >>
        >> End Function
        >>
        >> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
        >> ByVal EndRange As Object) As ParameterRangeV alue
        >> Dim paramRangeValue As ParameterRangeV alue
        >>
        >> paramRangeValue = New ParameterRangeV alue
        >>
        >> paramRangeValue .StartValue = StartRange
        >> paramRangeValue .EndValue = EndRange
        >>
        >> Return paramRangeValue
        >> End Function
        >>
        >> "Alison Givens" <info@cross-it.nl> wrote in message
        >> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...[color=darkred]
        >>> ...... that nobody knows the answer.
        >>> I can't imagine that I am the only one that uses parameters in CR.
        >>>
        >>> So, my question again:
        >>>
        >>> I have the following problem.
        >>> (VB.NET 2003 with CR)
        >>>
        >>> I have a report with a multiple-value discrete value and a rangevalue.
        >>> The report shows fine in the viewer, but when I hit the export to pdf
        >>> button, it only uses one of two discrete values.
        >>>
        >>> This is the code:
        >>> Dim BeginPeriode As String
        >>> Dim EindPeriode As String
        >>>
        >>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
        >>> EindPeriode = Request.QuerySt ring("EindPerio de")
        >>>
        >>> Dim myReport As New RapportAIRCOSto ringen
        >>>
        >>> Dim paramFields As New ParameterFields
        >>> Dim paramField As New ParameterField
        >>> Dim discreteVal As New ParameterDiscre teValue
        >>> Dim rangeVal As New ParameterRangeV alue
        >>>
        >>> paramField.Para meterFieldName = "FiliaalKeu ze"
        >>> discreteVal.Val ue = "2044"
        >>> paramField.Curr entValues.Add(d iscreteVal)
        >>>
        >>> discreteVal = New ParameterDiscre teValue
        >>> discreteVal.Val ue = "2344"
        >>> paramField.Curr entValues.Add(d iscreteVal)
        >>>
        >>> paramFields.Add (paramField)
        >>>
        >>> paramField = New ParameterField
        >>>
        >>> paramField.Para meterFieldName = "Periode"
        >>>
        >>> rangeVal.StartV alue = BeginPeriode
        >>> rangeVal.EndVal ue = EindPeriode
        >>> paramField.Curr entValues.Add(r angeVal)
        >>>
        >>> paramFields.Add (paramField)
        >>>
        >>> crViewer.Parame terFieldInfo = paramFields
        >>> myReport.SetPar ameterValue("Pe riode", rangeVal)
        >>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
        >>> crViewer.Report Source = myReport
        >>>
        >>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
        >>> It goes wrong with the discrete value. It only sees the second value I
        >>> entered and not the first.
        >>> How can I get this going?
        >>>
        >>>
        >>> Kind regards,
        >>> Alison
        >>>
        >>>
        >>>
        >>>[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • Alison Givens

          #5
          Re: How is it possible ...

          > Perhaps you could share your resulting code for comparison? Did you see[color=blue]
          > that I suggested the error in your code was
          >
          > myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call
          > this statement once (Effectively 2344) but you wanted two values.[/color]

          To get the thing going, it would be enough for me at first to know how to
          call the statement twice, so the other value is forwarded too.
          (btw, these two values will be SessionObjects two, but I did it hardcoded
          for testing)
          Best would be ofcourse that I learn to do it 'clean' of course. I am a real
          newbee at this.

          Here is the rest of my code:

          Imports CrystalDecision s.CrystalReport s.Engine
          Imports CrystalDecision s.CrystalReport s.Engine.Report Document
          Imports CrystalDecision s.Shared
          Imports System.IO


          Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles MyBase.Init
          'CODEGEN: This method call is required by the Web Form Designer
          'Do not modify it using the code editor.
          InitializeCompo nent()



          Dim myReport As RapportAIRCOSto ringen
          Dim paramFields As ParameterFields
          Dim paramField As ParameterField

          Dim BeginPeriode As String
          Dim EindPeriode As String

          'Todo wrap everything in try
          paramFields = New ParameterFields

          Try
          BeginPeriode = Request.QuerySt ring("BeginPeri ode")
          EindPeriode = Request.QuerySt ring("EindPerio de")
          Catch ex As Exception
          Dim exCustom As ApplicationExce ption
          exCustom = New ApplicationExce ption("Unable to parse Query
          Paramaters.", ex)
          Throw exCustom
          End Try

          'Todo wrap in try
          paramField = CreateParameter ("FiliaalKeuze" )
          paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
          paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
          myReport.SetPar ameterValue("Fi liaalKeuze", paramField)


          'Todo wrap in try
          paramField = CreateParameter ("Periode")
          paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
          EindPeriode))
          myReport.SetPar ameterValue("Pe riode", paramField)


          crViewer.Report Source = myReport


          'exporteren to pdf
          Dim myExportOptions As CrystalDecision s.Shared.Export Options
          Dim myDiskFileDesti nationOptions As
          CrystalDecision s.Shared.DiskFi leDestinationOp tions
          Dim myExportFile As String



          myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
          Session.Session ID.ToString & ".pdf"
          myDiskFileDesti nationOptions = New
          CrystalDecision s.Shared.DiskFi leDestinationOp tions
          myDiskFileDesti nationOptions.D iskFileName = myExportFile
          myExportOptions = myReport.Export Options
          With myExportOptions
          .DestinationOpt ions = myDiskFileDesti nationOptions
          .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
          .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
          End With

          Try
          myReport.Export ()
          Catch err As Exception
          Response.Write( "<BR>")
          Response.Write( err.Message.ToS tring)
          End Try

          Session("export bestand") = myExportFile
          End Sub

          #End Region

          Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles MyBase.Load
          'Put user code to initialize the page here
          End Sub
          Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles cmdPrint.Click
          Response.ClearC ontent()
          Response.ClearH eaders()
          Response.Conten tType = "applicatio n/pdf"
          Dim myExportFile As String = CType(Session.I tem("exportbest and"),
          String)

          Response.WriteF ile(myExportFil e)
          Response.Flush( )
          Response.Close( )

          System.IO.File. Delete(myExport File)
          End Sub

          Private Function CreateParameter (ByVal ParameterName As String) As
          ParameterField( )
          Dim paramField As ParameterField

          paramField = New ParameterField
          paramField.Para meterFieldName = ParameterName

          'Return paramField

          End Function

          Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
          ParameterDiscre teValue()

          Dim paramDiscreteVa lue As ParameterDiscre teValue
          paramDiscreteVa lue = New ParameterDiscre teValue
          paramDiscreteVa lue = Value

          'Return paramDiscreteVa lue

          End Function

          Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
          ByVal EndRange As Object) As ParameterRangeV alue
          Dim paramRangeValue As ParameterRangeV alue

          paramRangeValue = New ParameterRangeV alue

          paramRangeValue .StartValue = StartRange
          paramRangeValue .EndValue = EndRange

          Return paramRangeValue
          End Function


          Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles cmdEerste.Click
          crViewer.ShowFi rstPage()
          End Sub

          Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles cmdLaatste.Clic k
          crViewer.ShowLa stPage()
          End Sub

          Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles cmdTerug.Click
          crViewer.ShowPr eviousPage()
          End Sub

          Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
          System.EventArg s) Handles cmdVerder.Click
          crViewer.ShowNe xtPage()
          End Sub

          Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
          As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
          crViewer.Zoom(d rpZoom.Selected Item.Value)
          End Sub
          Private Sub Page_Unload(ByV al sender As Object, ByVal e As
          System.EventArg s) Handles MyBase.Unload
          Dim myExportFile As String = CType(Session.I tem("exportbest and"),
          String)

          System.IO.File. Delete(myExport File)
          End Sub
          End Class





          [color=blue]
          >
          > "Alison Givens" <info@cross-it.nl> wrote in message
          > news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...[color=green]
          >> When I use your solution I get blue lines under the text like this
          >>
          >> paramField = CreateParamater ("FiliaalKeuze" )
          >> The text is:
          >> Value of type '1 dimensional array of
          >> CrystalDecision s.Shared.Parame terField' cannot be converted
          >> to 'Crystal.Decisi ons.Shared.Para meterField'
          >>
          >> Return paramField
          >> The text is:
          >> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
          >> converted
          >> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
          >>
          >> Same for
          >> paramField = CreateParamater ("Periode")
          >> Return paramDiscreteVa lue
          >>
          >> Any idea what causes this?
          >>
          >> Alison
          >>
          >>
          >> "AMDRIT" <amdrit@hotmail .com> wrote in message
          >> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...[color=darkred]
          >>> Wow, you do all that for Crystal Reports? What is
          >>> RapportAIRCOSto ringen?
          >>>
          >>>
          >>> Here is all I do for CR
          >>>
          >>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
          >>>
          >>> x.Load(sReportP ath) 'Reports are not embedded resources
          >>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
          >>> Paramaters
          >>> x.SetParameterV alue("Paramater 2", Paramaters(2))
          >>> x.SetDataSource (mydata) 'Strongly Typed Datasets
          >>>
          >>> Me.CrystalRepor tViewer1.Report Source = x
          >>> Me.CrystalRepor tViewer1.PrintR eport()
          >>>
          >>>
          >>> 'Now to answer your question about your code, hmm
          >>>
          >>> Ok, first
          >>>
          >>> Never --> Dim x as new object
          >>> 'This is silly, lazy and unprofessional. So if you are in high
          >>> school, keep the course.
          >>>
          >>>
          >>> Instead --> Dim x as object
          >>> Set x = new object
          >>> 'Reserve your space and contract
          >>> 'Then make use of it.
          >>>
          >>> I think this is your problem
          >>>
          >>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
          >>>
          >>> Why are you setting the crView paramaters and the myReport paramaters?
          >>> -->crViewer.Param eterFieldInfo = paramFields
          >>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
          >>>
          >>> I think that myReport is the only think that needs to be set
          >>>
          >>>
          >>> I had to spent time reading your code to understand what you were doing.
          >>>
          >>> Here is an attempt to clean it up.
          >>>
          >>> Private Sub TestIT()
          >>>
          >>> Dim myReport As RapportAIRCOSto ringen
          >>> Dim paramFields As ParameterFields
          >>> Dim paramField As ParameterField
          >>>
          >>> Dim BeginPeriode As String
          >>> Dim EindPeriode As String
          >>>
          >>> 'Todo wrap everything in try
          >>> paramFields = New ParameterFields
          >>>
          >>> Try
          >>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
          >>> EindPeriode = Request.QuerySt ring("EindPerio de")
          >>> Catch ex As Exception
          >>> Dim exCustom As ApplicationExce ption
          >>> exCustom = New ApplicationExce ption("Unable to parse Query
          >>> Paramaters.", ex)
          >>> Throw exCustom
          >>> End Try
          >>>
          >>> 'Todo wrap in try
          >>> paramField = CreateParamater ("FiliaalKeuze" )
          >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
          >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
          >>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
          >>> 'paramFields.Ad d(paramField) --> Not needed
          >>>
          >>> 'Todo wrap in try
          >>> paramField = CreateParamater ("Periode")
          >>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
          >>> EindPeriode))
          >>> myReport.SetPar ameterValue("Pe riode", paramField)
          >>> 'paramFields.Ad d(paramField)--> Not needed
          >>>
          >>> 'Todo wrap in try, i don't think you need this
          >>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
          >>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
          >>>
          >>> 'Todo, determine if we need this step; I don't think you do
          >>> 'crViewer.Param eterFieldInfo = paramFields
          >>>
          >>> crViewer.Report Source = myReport
          >>>
          >>> End Sub
          >>>
          >>> Private Function CreateParamater (ByVal ParamaterName As String) As
          >>> ParameterField
          >>> Dim paramField As ParameterField
          >>>
          >>> paramField = New ParameterField
          >>> paramField.Para meterFieldName = ParamaterName
          >>>
          >>> Return paramField
          >>>
          >>> End Function
          >>>
          >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
          >>> ParameterDiscre teValue
          >>>
          >>> Dim paramDiscreteVa lue As ParameterDiscre teValue
          >>> paramDiscreteVa lue = New ParameterDiscre teValue
          >>> paramDiscreteVa lue = Value
          >>>
          >>> Return paramDiscreteVa lue
          >>>
          >>> End Function
          >>>
          >>> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
          >>> ByVal EndRange As Object) As ParameterRangeV alue
          >>> Dim paramRangeValue As ParameterRangeV alue
          >>>
          >>> paramRangeValue = New ParameterRangeV alue
          >>>
          >>> paramRangeValue .StartValue = StartRange
          >>> paramRangeValue .EndValue = EndRange
          >>>
          >>> Return paramRangeValue
          >>> End Function
          >>>
          >>> "Alison Givens" <info@cross-it.nl> wrote in message
          >>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
          >>>> ...... that nobody knows the answer.
          >>>> I can't imagine that I am the only one that uses parameters in CR.
          >>>>
          >>>> So, my question again:
          >>>>
          >>>> I have the following problem.
          >>>> (VB.NET 2003 with CR)
          >>>>
          >>>> I have a report with a multiple-value discrete value and a rangevalue.
          >>>> The report shows fine in the viewer, but when I hit the export to pdf
          >>>> button, it only uses one of two discrete values.
          >>>>
          >>>> This is the code:
          >>>> Dim BeginPeriode As String
          >>>> Dim EindPeriode As String
          >>>>
          >>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
          >>>> EindPeriode = Request.QuerySt ring("EindPerio de")
          >>>>
          >>>> Dim myReport As New RapportAIRCOSto ringen
          >>>>
          >>>> Dim paramFields As New ParameterFields
          >>>> Dim paramField As New ParameterField
          >>>> Dim discreteVal As New ParameterDiscre teValue
          >>>> Dim rangeVal As New ParameterRangeV alue
          >>>>
          >>>> paramField.Para meterFieldName = "FiliaalKeu ze"
          >>>> discreteVal.Val ue = "2044"
          >>>> paramField.Curr entValues.Add(d iscreteVal)
          >>>>
          >>>> discreteVal = New ParameterDiscre teValue
          >>>> discreteVal.Val ue = "2344"
          >>>> paramField.Curr entValues.Add(d iscreteVal)
          >>>>
          >>>> paramFields.Add (paramField)
          >>>>
          >>>> paramField = New ParameterField
          >>>>
          >>>> paramField.Para meterFieldName = "Periode"
          >>>>
          >>>> rangeVal.StartV alue = BeginPeriode
          >>>> rangeVal.EndVal ue = EindPeriode
          >>>> paramField.Curr entValues.Add(r angeVal)
          >>>>
          >>>> paramFields.Add (paramField)
          >>>>
          >>>> crViewer.Parame terFieldInfo = paramFields
          >>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
          >>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
          >>>> crViewer.Report Source = myReport
          >>>>
          >>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
          >>>> It goes wrong with the discrete value. It only sees the second value I
          >>>> entered and not the first.
          >>>> How can I get this going?
          >>>>
          >>>>
          >>>> Kind regards,
          >>>> Alison
          >>>>
          >>>>
          >>>>
          >>>>
          >>>
          >>>[/color]
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • AMDRIT

            #6
            Re: How is it possible ...

            Ok, first the isue you were having with the "Blue lines" is:

            Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
            ParameterDiscre teValue()
            --> Retun type is expecting an array of ParameterDiscre teValue

            it should be

            Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
            ParameterDiscre teValue
            --> Retun type is expecting an single ParameterDiscre teValue

            Second (Mostly because I was bored and also because I am still a novice), I
            have altered your code yet again.


            Private Enum FileNameFormats
            SessionID = 0
            GUIDDashes = 1
            GUIDNoDashes = 2
            End Enum

            Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeCompo nent()

            Dim myReport As RapportAIRCOSto ringen
            Dim myExportOptions As CrystalDecision s.Shared.Export Options

            Try

            Try
            PrepareReport(m yReport)
            Catch ex As Exception
            Dim exc As ApplicationExce ption
            exc = New ApplicationExce ption("Unable to prepare report.", ex)
            Throw exc
            End Try

            Try
            'exporteren to pdf
            myExportOptions = GetExportOption s(FileNameForma ts.GUIDNoDashes ,
            CType(myReport,
            CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
            myReport.Export ()

            Catch ex As Exception
            Dim exc As ApplicationExce ption
            exc = New ApplicationExce ption("Unable to export report.", ex)
            Throw exc
            End Try

            crViewer.Report Source = myReport

            Session("export bestand") = CType(myExportO ptions.Destinat ionOptions,
            CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name

            Catch err As Exception
            Response.Write( "<BR>")
            Response.Write( err.Message.ToS tring)
            End Try

            End Sub

            #Region "Page Implementation"

            Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles MyBase.Load
            'Put user code to initialize the page here
            End Sub

            Private Sub Page_Unload(ByV al sender As Object, ByVal e As
            System.EventArg s) Handles MyBase.Unload
            Dim myExportFile As String = CType(Session.I tem("exportbest and"),
            String)

            System.IO.File. Delete(myExport File)
            End Sub

            #End Region

            #Region "Report Setup"

            Private Sub PrepareReport(B yVal myReport As
            CrystalDecision s.CrystalReport s.Engine.Report Document)

            Dim paramFields As ParameterFields
            Dim paramField As ParameterField

            Const SessionExecptio n As String = "Unable to read session objects."

            Try

            paramFields = New ParameterFields
            Try
            paramField = CreateParameter ("FiliaalKeuze" )
            paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
            paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
            Catch ex As Exception
            Dim exc As System.Applicat ionException
            exc = New System.Applicat ionException(Se ssionExecption, ex)
            Throw exc
            End Try

            myReport.SetPar ameterValue("Fi liaalKeuze", paramField)

            Try
            'Todo wrap in try
            paramField = CreateParameter ("Periode")
            paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
            GetSessionValue ("EindPeriode") ))
            Catch ex As Exception
            Dim exc As System.Applicat ionException
            exc = New System.Applicat ionException(Se ssionExecption, ex)
            Throw exc
            End Try

            myReport.SetPar ameterValue("Pe riode", paramField)

            Catch ex As Exception

            Dim exc As System.Applicat ionException
            exc = New System.Applicat ionException("U nable to set paramater
            value.", ex)
            Throw exc

            End Try


            End Sub

            Private Function CreateParameter (ByVal ParameterName As String) As
            ParameterField
            Dim paramField As ParameterField

            paramField = New ParameterField
            paramField.Para meterFieldName = ParameterName

            Return paramField

            End Function

            Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
            ParameterDiscre teValue()

            Dim paramDiscreteVa lue As ParameterDiscre teValue
            paramDiscreteVa lue = New ParameterDiscre teValue
            paramDiscreteVa lue = Value

            'Return paramDiscreteVa lue

            End Function

            Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
            ByVal EndRange As Object) As ParameterRangeV alue
            Dim paramRangeValue As ParameterRangeV alue

            paramRangeValue = New ParameterRangeV alue

            paramRangeValue .StartValue = StartRange
            paramRangeValue .EndValue = EndRange

            Return paramRangeValue
            End Function

            #End Region

            #Region "Report Export"

            Private Function GetExportOption s(ByVal UniqueFormat As FileNameFormats ,
            ByVal ExportOptions As CrystalDecision s.Shared.Export Options) As
            CrystalDecision s.Shared.Export Options

            Dim myExportFile As String
            Dim myExportOptions As CrystalDecision s.Shared.Export Options
            Dim myDiskFileDesti nationOptions As
            CrystalDecision s.Shared.DiskFi leDestinationOp tions

            Try

            Select Case UniqueFormat
            Case FileNameFormats .SessionID
            myExportFile = Session.Session ID.ToString
            Case FileNameFormats .GUIDDashes
            myExportFile = System.Guid.New Guid.ToString(" D")
            Case FileNameFormats .GUIDNoDashes
            myExportFile = System.Guid.New Guid.ToString(" N")
            End Select

            myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
            String.Format(" PDF_{0}.pdf", myExportFile))

            myDiskFileDesti nationOptions = New
            CrystalDecision s.Shared.DiskFi leDestinationOp tions
            myDiskFileDesti nationOptions.D iskFileName = myExportFile

            myExportOptions = ExportOptions

            With myExportOptions
            .DestinationOpt ions = myDiskFileDesti nationOptions
            .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
            .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
            End With

            Catch ex As Exception

            Dim exc As System.Applicat ionException
            exc = New System.Applicat ionException("U nable to prepare export
            options.", ex)
            Throw exc

            End Try

            Return myExportOptions

            End Function

            Private Function GetExportRoot(B yVal FromApplication As Boolean) As String

            Dim strExportRoot As String

            If FromApplication Then
            Try
            Application.loc k()
            strExportRoot = Application("Re portExportRoot" )
            Catch ex As Exception
            Dim exc As ApplicationExce ption
            exc = New ApplicationExce ption("Unable to lock Web Application for
            read.", ex)
            Throw exc
            Finally
            Application.unl ock()
            End Try
            Else
            strExportRoot = Session("Report ExportRoot")
            End If

            Return strExportRoot

            End Function

            #End Region

            #Region "Navigation Implementation"

            Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles cmdPrint.Click

            Response.ClearC ontent()
            Response.ClearH eaders()
            Response.Conten tType = "applicatio n/pdf"

            Dim myExportFile As String = CType(Session.I tem("exportbest and"),
            String)

            Response.WriteF ile(myExportFil e)
            Response.Flush( )
            Response.Close( )

            System.IO.File. Delete(myExport File)

            End Sub

            Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles cmdEerste.Click
            crViewer.ShowFi rstPage()
            End Sub

            Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles cmdLaatste.Clic k
            crViewer.ShowLa stPage()
            End Sub

            Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles cmdTerug.Click
            crViewer.ShowPr eviousPage()
            End Sub

            Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles cmdVerder.Click
            crViewer.ShowNe xtPage()
            End Sub

            Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
            As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
            crViewer.Zoom(d rpZoom.Selected Item.Value)
            End Sub

            #End Region


            "Alison Givens" <info@cross-it.nl> wrote in message
            news:%23RW%23bs jNGHA.2124@TK2M SFTNGP14.phx.gb l...[color=blue][color=green]
            >> Perhaps you could share your resulting code for comparison? Did you see
            >> that I suggested the error in your code was
            >>
            >> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call
            >> this statement once (Effectively 2344) but you wanted two values.[/color]
            >
            > To get the thing going, it would be enough for me at first to know how to
            > call the statement twice, so the other value is forwarded too.
            > (btw, these two values will be SessionObjects two, but I did it hardcoded
            > for testing)
            > Best would be ofcourse that I learn to do it 'clean' of course. I am a
            > real newbee at this.
            >
            > Here is the rest of my code:
            >
            > Imports CrystalDecision s.CrystalReport s.Engine
            > Imports CrystalDecision s.CrystalReport s.Engine.Report Document
            > Imports CrystalDecision s.Shared
            > Imports System.IO
            >
            >
            > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles MyBase.Init
            > 'CODEGEN: This method call is required by the Web Form Designer
            > 'Do not modify it using the code editor.
            > InitializeCompo nent()
            >
            >
            >
            > Dim myReport As RapportAIRCOSto ringen
            > Dim paramFields As ParameterFields
            > Dim paramField As ParameterField
            >
            > Dim BeginPeriode As String
            > Dim EindPeriode As String
            >
            > 'Todo wrap everything in try
            > paramFields = New ParameterFields
            >
            > Try
            > BeginPeriode = Request.QuerySt ring("BeginPeri ode")
            > EindPeriode = Request.QuerySt ring("EindPerio de")
            > Catch ex As Exception
            > Dim exCustom As ApplicationExce ption
            > exCustom = New ApplicationExce ption("Unable to parse Query
            > Paramaters.", ex)
            > Throw exCustom
            > End Try
            >
            > 'Todo wrap in try
            > paramField = CreateParameter ("FiliaalKeuze" )
            > paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
            > paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
            > myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
            >
            >
            > 'Todo wrap in try
            > paramField = CreateParameter ("Periode")
            >
            > paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
            > EindPeriode))
            > myReport.SetPar ameterValue("Pe riode", paramField)
            >
            >
            > crViewer.Report Source = myReport
            >
            >
            > 'exporteren to pdf
            > Dim myExportOptions As CrystalDecision s.Shared.Export Options
            > Dim myDiskFileDesti nationOptions As
            > CrystalDecision s.Shared.DiskFi leDestinationOp tions
            > Dim myExportFile As String
            >
            >
            >
            > myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
            > Session.Session ID.ToString & ".pdf"
            > myDiskFileDesti nationOptions = New
            > CrystalDecision s.Shared.DiskFi leDestinationOp tions
            > myDiskFileDesti nationOptions.D iskFileName = myExportFile
            > myExportOptions = myReport.Export Options
            > With myExportOptions
            > .DestinationOpt ions = myDiskFileDesti nationOptions
            > .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
            > .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
            > End With
            >
            > Try
            > myReport.Export ()
            > Catch err As Exception
            > Response.Write( "<BR>")
            > Response.Write( err.Message.ToS tring)
            > End Try
            >
            > Session("export bestand") = myExportFile
            > End Sub
            >
            > #End Region
            >
            > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles MyBase.Load
            > 'Put user code to initialize the page here
            > End Sub
            > Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles cmdPrint.Click
            > Response.ClearC ontent()
            > Response.ClearH eaders()
            > Response.Conten tType = "applicatio n/pdf"
            > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
            > String)
            >
            > Response.WriteF ile(myExportFil e)
            > Response.Flush( )
            > Response.Close( )
            >
            > System.IO.File. Delete(myExport File)
            > End Sub
            >
            > Private Function CreateParameter (ByVal ParameterName As String) As
            > ParameterField( )
            > Dim paramField As ParameterField
            >
            > paramField = New ParameterField
            > paramField.Para meterFieldName = ParameterName
            >
            > 'Return paramField
            >
            > End Function
            >
            > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
            > ParameterDiscre teValue()
            >
            > Dim paramDiscreteVa lue As ParameterDiscre teValue
            > paramDiscreteVa lue = New ParameterDiscre teValue
            > paramDiscreteVa lue = Value
            >
            > 'Return paramDiscreteVa lue
            >
            > End Function
            >
            > Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
            > ByVal EndRange As Object) As ParameterRangeV alue
            > Dim paramRangeValue As ParameterRangeV alue
            >
            > paramRangeValue = New ParameterRangeV alue
            >
            > paramRangeValue .StartValue = StartRange
            > paramRangeValue .EndValue = EndRange
            >
            > Return paramRangeValue
            > End Function
            >
            >
            > Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles cmdEerste.Click
            > crViewer.ShowFi rstPage()
            > End Sub
            >
            > Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles cmdLaatste.Clic k
            > crViewer.ShowLa stPage()
            > End Sub
            >
            > Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles cmdTerug.Click
            > crViewer.ShowPr eviousPage()
            > End Sub
            >
            > Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
            > System.EventArg s) Handles cmdVerder.Click
            > crViewer.ShowNe xtPage()
            > End Sub
            >
            > Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
            > e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
            > crViewer.Zoom(d rpZoom.Selected Item.Value)
            > End Sub
            > Private Sub Page_Unload(ByV al sender As Object, ByVal e As
            > System.EventArg s) Handles MyBase.Unload
            > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
            > String)
            >
            > System.IO.File. Delete(myExport File)
            > End Sub
            > End Class
            >
            >
            >
            >
            >
            >[color=green]
            >>
            >> "Alison Givens" <info@cross-it.nl> wrote in message
            >> news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...[color=darkred]
            >>> When I use your solution I get blue lines under the text like this
            >>>
            >>> paramField = CreateParamater ("FiliaalKeuze" )
            >>> The text is:
            >>> Value of type '1 dimensional array of
            >>> CrystalDecision s.Shared.Parame terField' cannot be converted
            >>> to 'Crystal.Decisi ons.Shared.Para meterField'
            >>>
            >>> Return paramField
            >>> The text is:
            >>> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
            >>> converted
            >>> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
            >>>
            >>> Same for
            >>> paramField = CreateParamater ("Periode")
            >>> Return paramDiscreteVa lue
            >>>
            >>> Any idea what causes this?
            >>>
            >>> Alison
            >>>
            >>>
            >>> "AMDRIT" <amdrit@hotmail .com> wrote in message
            >>> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...
            >>>> Wow, you do all that for Crystal Reports? What is
            >>>> RapportAIRCOSto ringen?
            >>>>
            >>>>
            >>>> Here is all I do for CR
            >>>>
            >>>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
            >>>>
            >>>> x.Load(sReportP ath) 'Reports are not embedded resources
            >>>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
            >>>> Paramaters
            >>>> x.SetParameterV alue("Paramater 2", Paramaters(2))
            >>>> x.SetDataSource (mydata) 'Strongly Typed Datasets
            >>>>
            >>>> Me.CrystalRepor tViewer1.Report Source = x
            >>>> Me.CrystalRepor tViewer1.PrintR eport()
            >>>>
            >>>>
            >>>> 'Now to answer your question about your code, hmm
            >>>>
            >>>> Ok, first
            >>>>
            >>>> Never --> Dim x as new object
            >>>> 'This is silly, lazy and unprofessional. So if you are in high
            >>>> school, keep the course.
            >>>>
            >>>>
            >>>> Instead --> Dim x as object
            >>>> Set x = new object
            >>>> 'Reserve your space and contract
            >>>> 'Then make use of it.
            >>>>
            >>>> I think this is your problem
            >>>>
            >>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
            >>>>
            >>>> Why are you setting the crView paramaters and the myReport paramaters?
            >>>> -->crViewer.Param eterFieldInfo = paramFields
            >>>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
            >>>>
            >>>> I think that myReport is the only think that needs to be set
            >>>>
            >>>>
            >>>> I had to spent time reading your code to understand what you were
            >>>> doing.
            >>>>
            >>>> Here is an attempt to clean it up.
            >>>>
            >>>> Private Sub TestIT()
            >>>>
            >>>> Dim myReport As RapportAIRCOSto ringen
            >>>> Dim paramFields As ParameterFields
            >>>> Dim paramField As ParameterField
            >>>>
            >>>> Dim BeginPeriode As String
            >>>> Dim EindPeriode As String
            >>>>
            >>>> 'Todo wrap everything in try
            >>>> paramFields = New ParameterFields
            >>>>
            >>>> Try
            >>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
            >>>> EindPeriode = Request.QuerySt ring("EindPerio de")
            >>>> Catch ex As Exception
            >>>> Dim exCustom As ApplicationExce ption
            >>>> exCustom = New ApplicationExce ption("Unable to parse Query
            >>>> Paramaters.", ex)
            >>>> Throw exCustom
            >>>> End Try
            >>>>
            >>>> 'Todo wrap in try
            >>>> paramField = CreateParamater ("FiliaalKeuze" )
            >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
            >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
            >>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
            >>>> 'paramFields.Ad d(paramField) --> Not needed
            >>>>
            >>>> 'Todo wrap in try
            >>>> paramField = CreateParamater ("Periode")
            >>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
            >>>> EindPeriode))
            >>>> myReport.SetPar ameterValue("Pe riode", paramField)
            >>>> 'paramFields.Ad d(paramField)--> Not needed
            >>>>
            >>>> 'Todo wrap in try, i don't think you need this
            >>>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
            >>>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
            >>>>
            >>>> 'Todo, determine if we need this step; I don't think you do
            >>>> 'crViewer.Param eterFieldInfo = paramFields
            >>>>
            >>>> crViewer.Report Source = myReport
            >>>>
            >>>> End Sub
            >>>>
            >>>> Private Function CreateParamater (ByVal ParamaterName As String) As
            >>>> ParameterField
            >>>> Dim paramField As ParameterField
            >>>>
            >>>> paramField = New ParameterField
            >>>> paramField.Para meterFieldName = ParamaterName
            >>>>
            >>>> Return paramField
            >>>>
            >>>> End Function
            >>>>
            >>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
            >>>> As ParameterDiscre teValue
            >>>>
            >>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
            >>>> paramDiscreteVa lue = New ParameterDiscre teValue
            >>>> paramDiscreteVa lue = Value
            >>>>
            >>>> Return paramDiscreteVa lue
            >>>>
            >>>> End Function
            >>>>
            >>>> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
            >>>> ByVal EndRange As Object) As ParameterRangeV alue
            >>>> Dim paramRangeValue As ParameterRangeV alue
            >>>>
            >>>> paramRangeValue = New ParameterRangeV alue
            >>>>
            >>>> paramRangeValue .StartValue = StartRange
            >>>> paramRangeValue .EndValue = EndRange
            >>>>
            >>>> Return paramRangeValue
            >>>> End Function
            >>>>
            >>>> "Alison Givens" <info@cross-it.nl> wrote in message
            >>>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
            >>>>> ...... that nobody knows the answer.
            >>>>> I can't imagine that I am the only one that uses parameters in CR.
            >>>>>
            >>>>> So, my question again:
            >>>>>
            >>>>> I have the following problem.
            >>>>> (VB.NET 2003 with CR)
            >>>>>
            >>>>> I have a report with a multiple-value discrete value and a rangevalue.
            >>>>> The report shows fine in the viewer, but when I hit the export to pdf
            >>>>> button, it only uses one of two discrete values.
            >>>>>
            >>>>> This is the code:
            >>>>> Dim BeginPeriode As String
            >>>>> Dim EindPeriode As String
            >>>>>
            >>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
            >>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
            >>>>>
            >>>>> Dim myReport As New RapportAIRCOSto ringen
            >>>>>
            >>>>> Dim paramFields As New ParameterFields
            >>>>> Dim paramField As New ParameterField
            >>>>> Dim discreteVal As New ParameterDiscre teValue
            >>>>> Dim rangeVal As New ParameterRangeV alue
            >>>>>
            >>>>> paramField.Para meterFieldName = "FiliaalKeu ze"
            >>>>> discreteVal.Val ue = "2044"
            >>>>> paramField.Curr entValues.Add(d iscreteVal)
            >>>>>
            >>>>> discreteVal = New ParameterDiscre teValue
            >>>>> discreteVal.Val ue = "2344"
            >>>>> paramField.Curr entValues.Add(d iscreteVal)
            >>>>>
            >>>>> paramFields.Add (paramField)
            >>>>>
            >>>>> paramField = New ParameterField
            >>>>>
            >>>>> paramField.Para meterFieldName = "Periode"
            >>>>>
            >>>>> rangeVal.StartV alue = BeginPeriode
            >>>>> rangeVal.EndVal ue = EindPeriode
            >>>>> paramField.Curr entValues.Add(r angeVal)
            >>>>>
            >>>>> paramFields.Add (paramField)
            >>>>>
            >>>>> crViewer.Parame terFieldInfo = paramFields
            >>>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
            >>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
            >>>>> crViewer.Report Source = myReport
            >>>>>
            >>>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
            >>>>> It goes wrong with the discrete value. It only sees the second value I
            >>>>> entered and not the first.
            >>>>> How can I get this going?
            >>>>>
            >>>>>
            >>>>> Kind regards,
            >>>>> Alison
            >>>>>
            >>>>>
            >>>>>
            >>>>>
            >>>>
            >>>>
            >>>
            >>>[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            • Alison Givens

              #7
              Re: How is it possible ...

              I used the code as you suggested, but again I get blue underlines.
              First with every GetSessionValue ,it has a blue underline:
              Name GetSessionValue is not declared

              and the other blue underline is GetExportRoot
              myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
              String.Format(" PDF_{0}.pdf", myExportFile))
              Says:Argument not specified for parameter 'FromApplicatio n' of
              'Private Function GetExportRoot(F romApplication As Boolean) As String'.

              I pasted the code again for your convenience.



              Private Enum FileNameFormats
              SessionID = 0
              GUIDDashes = 1
              GUIDNoDashes = 2
              End Enum


              Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles MyBase.Init
              'CODEGEN: This method call is required by the Web Form Designer
              'Do not modify it using the code editor.
              InitializeCompo nent()
              Dim myReport As RapportAIRCOSto ringen
              Dim myExportOptions As CrystalDecision s.Shared.Export Options

              Try

              Try
              PrepareReport(m yReport)
              Catch ex As Exception
              Dim exc As ApplicationExce ption
              exc = New ApplicationExce ption("Unable to prepare report.",
              ex)
              Throw exc
              End Try

              Try
              'exporteren to pdf
              myExportOptions =
              GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
              CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
              myReport.Export ()

              Catch ex As Exception
              Dim exc As ApplicationExce ption
              exc = New ApplicationExce ption("Unable to export report.",
              ex)
              Throw exc
              End Try

              crViewer.Report Source = myReport

              Session("export bestand") =
              CType(myExportO ptions.Destinat ionOptions,
              CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name

              Catch err As Exception
              Response.Write( "<BR>")
              Response.Write( err.Message.ToS tring)
              End Try




              End Sub

              #End Region

              #Region "Page Implementation"

              Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles MyBase.Load
              'Put user code to initialize the page here
              End Sub

              Private Sub Page_Unload(ByV al sender As Object, ByVal e As
              System.EventArg s) Handles MyBase.Unload
              Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              String)

              System.IO.File. Delete(myExport File)
              End Sub

              #End Region

              #Region "Report Setup"

              Private Sub PrepareReport(B yVal myReport As
              CrystalDecision s.CrystalReport s.Engine.Report Document)

              Dim paramFields As ParameterFields
              Dim paramField As ParameterField

              Const SessionExecptio n As String = "Unable to read session objects."

              Try

              paramFields = New ParameterFields
              Try
              paramField = CreateParameter ("FiliaalKeuze" )
              paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
              paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))

              Catch ex As Exception
              Dim exc As System.Applicat ionException
              exc = New System.Applicat ionException(Se ssionExecption, ex)
              Throw exc
              End Try

              myReport.SetPar ameterValue("Fi liaalKeuze", paramField)

              Try
              'Todo wrap in try
              paramField = CreateParameter ("Periode")
              paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
              GetSessionValue ("EindPeriode") ))
              Catch ex As Exception
              Dim exc As System.Applicat ionException
              exc = New System.Applicat ionException(Se ssionExecption, ex)
              Throw exc
              End Try

              myReport.SetPar ameterValue("Pe riode", paramField)

              Catch ex As Exception

              Dim exc As System.Applicat ionException
              exc = New System.Applicat ionException("U nable to set
              paramatervalue. ", ex)
              Throw exc

              End Try


              End Sub

              Private Function CreateParameter (ByVal ParameterName As String) As
              ParameterField
              Dim paramField As ParameterField

              paramField = New ParameterField
              paramField.Para meterFieldName = ParameterName

              Return paramField

              End Function

              Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
              ParameterDiscre teValue

              Dim paramDiscreteVa lue As ParameterDiscre teValue
              paramDiscreteVa lue = New ParameterDiscre teValue
              paramDiscreteVa lue = Value

              Return paramDiscreteVa lue

              End Function

              Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
              ByVal EndRange As Object) As ParameterRangeV alue
              Dim paramRangeValue As ParameterRangeV alue

              paramRangeValue = New ParameterRangeV alue

              paramRangeValue .StartValue = StartRange
              paramRangeValue .EndValue = EndRange

              Return paramRangeValue
              End Function

              #End Region

              #Region "Report Export"

              Private Function GetExportOption s(ByVal UniqueFormat As FileNameFormats ,
              ByVal ExportOptions As CrystalDecision s.Shared.Export Options) As
              CrystalDecision s.Shared.Export Options

              Dim myExportFile As String
              Dim myExportOptions As CrystalDecision s.Shared.Export Options
              Dim myDiskFileDesti nationOptions As
              CrystalDecision s.Shared.DiskFi leDestinationOp tions

              Try

              Select Case UniqueFormat
              Case FileNameFormats .SessionID
              myExportFile = Session.Session ID.ToString
              Case FileNameFormats .GUIDDashes
              myExportFile = System.Guid.New Guid.ToString(" D")
              Case FileNameFormats .GUIDNoDashes
              myExportFile = System.Guid.New Guid.ToString(" N")
              End Select

              myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
              String.Format(" PDF_{0}.pdf", myExportFile))

              myDiskFileDesti nationOptions = New
              CrystalDecision s.Shared.DiskFi leDestinationOp tions
              myDiskFileDesti nationOptions.D iskFileName = myExportFile

              myExportOptions = ExportOptions

              With myExportOptions
              .DestinationOpt ions = myDiskFileDesti nationOptions
              .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
              .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
              End With

              Catch ex As Exception

              Dim exc As System.Applicat ionException
              exc = New System.Applicat ionException("U nable to prepare export
              options.", ex)
              Throw exc

              End Try

              Return myExportOptions

              End Function

              Private Function GetExportRoot(B yVal FromApplication As Boolean) As
              String

              Dim strExportRoot As String

              If FromApplication Then
              Try
              Application.Loc k()
              strExportRoot = Application("Re portExportRoot" )
              Catch ex As Exception
              Dim exc As ApplicationExce ption
              exc = New ApplicationExce ption("Unable to lock Web
              Application for read.", ex)
              Throw exc
              Finally
              Application.UnL ock()
              End Try
              Else
              strExportRoot = Session("Report ExportRoot")
              End If

              Return strExportRoot

              End Function

              #End Region

              #Region "Navigation Implementation"

              Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles cmdPrint.Click

              Response.ClearC ontent()
              Response.ClearH eaders()
              Response.Conten tType = "applicatio n/pdf"

              Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              String)

              Response.WriteF ile(myExportFil e)
              Response.Flush( )
              Response.Close( )

              System.IO.File. Delete(myExport File)

              End Sub

              Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles cmdEerste.Click
              crViewer.ShowFi rstPage()
              End Sub

              Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles cmdLaatste.Clic k
              crViewer.ShowLa stPage()
              End Sub

              Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles cmdTerug.Click
              crViewer.ShowPr eviousPage()
              End Sub

              Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
              System.EventArg s) Handles cmdVerder.Click
              crViewer.ShowNe xtPage()
              End Sub

              Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
              As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
              crViewer.Zoom(d rpZoom.Selected Item.Value)
              End Sub

              #End Region


              End Class




              "AMDRIT" <amdrit@hotmail .com> wrote in message
              news:OpMDndkNGH A.2064@TK2MSFTN GP09.phx.gbl...[color=blue]
              > Ok, first the isue you were having with the "Blue lines" is:
              >
              > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
              > ParameterDiscre teValue()
              > --> Retun type is expecting an array of ParameterDiscre teValue
              >
              > it should be
              >
              > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
              > ParameterDiscre teValue
              > --> Retun type is expecting an single ParameterDiscre teValue
              >
              > Second (Mostly because I was bored and also because I am still a novice),
              > I have altered your code yet again.
              >
              >
              > Private Enum FileNameFormats
              > SessionID = 0
              > GUIDDashes = 1
              > GUIDNoDashes = 2
              > End Enum
              >
              > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles MyBase.Init
              > 'CODEGEN: This method call is required by the Web Form Designer
              > 'Do not modify it using the code editor.
              > InitializeCompo nent()
              >
              > Dim myReport As RapportAIRCOSto ringen
              > Dim myExportOptions As CrystalDecision s.Shared.Export Options
              >
              > Try
              >
              > Try
              > PrepareReport(m yReport)
              > Catch ex As Exception
              > Dim exc As ApplicationExce ption
              > exc = New ApplicationExce ption("Unable to prepare report.", ex)
              > Throw exc
              > End Try
              >
              > Try
              > 'exporteren to pdf
              > myExportOptions = GetExportOption s(FileNameForma ts.GUIDNoDashes ,
              > CType(myReport,
              > CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
              > myReport.Export ()
              >
              > Catch ex As Exception
              > Dim exc As ApplicationExce ption
              > exc = New ApplicationExce ption("Unable to export report.", ex)
              > Throw exc
              > End Try
              >
              > crViewer.Report Source = myReport
              >
              > Session("export bestand") = CType(myExportO ptions.Destinat ionOptions,
              > CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
              >
              > Catch err As Exception
              > Response.Write( "<BR>")
              > Response.Write( err.Message.ToS tring)
              > End Try
              >
              > End Sub
              >
              > #Region "Page Implementation"
              >
              > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles MyBase.Load
              > 'Put user code to initialize the page here
              > End Sub
              >
              > Private Sub Page_Unload(ByV al sender As Object, ByVal e As
              > System.EventArg s) Handles MyBase.Unload
              > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              > String)
              >
              > System.IO.File. Delete(myExport File)
              > End Sub
              >
              > #End Region
              >
              > #Region "Report Setup"
              >
              > Private Sub PrepareReport(B yVal myReport As
              > CrystalDecision s.CrystalReport s.Engine.Report Document)
              >
              > Dim paramFields As ParameterFields
              > Dim paramField As ParameterField
              >
              > Const SessionExecptio n As String = "Unable to read session objects."
              >
              > Try
              >
              > paramFields = New ParameterFields
              > Try
              > paramField = CreateParameter ("FiliaalKeuze" )
              >
              > paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
              >
              > paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
              > Catch ex As Exception
              > Dim exc As System.Applicat ionException
              > exc = New System.Applicat ionException(Se ssionExecption, ex)
              > Throw exc
              > End Try
              >
              > myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
              >
              > Try
              > 'Todo wrap in try
              > paramField = CreateParameter ("Periode")
              >
              > paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
              > GetSessionValue ("EindPeriode") ))
              > Catch ex As Exception
              > Dim exc As System.Applicat ionException
              > exc = New System.Applicat ionException(Se ssionExecption, ex)
              > Throw exc
              > End Try
              >
              > myReport.SetPar ameterValue("Pe riode", paramField)
              >
              > Catch ex As Exception
              >
              > Dim exc As System.Applicat ionException
              > exc = New System.Applicat ionException("U nable to set paramater
              > value.", ex)
              > Throw exc
              >
              > End Try
              >
              >
              > End Sub
              >
              > Private Function CreateParameter (ByVal ParameterName As String) As
              > ParameterField
              > Dim paramField As ParameterField
              >
              > paramField = New ParameterField
              > paramField.Para meterFieldName = ParameterName
              >
              > Return paramField
              >
              > End Function
              >
              > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
              > ParameterDiscre teValue()
              >
              > Dim paramDiscreteVa lue As ParameterDiscre teValue
              > paramDiscreteVa lue = New ParameterDiscre teValue
              > paramDiscreteVa lue = Value
              >
              > 'Return paramDiscreteVa lue
              >
              > End Function
              >
              > Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
              > ByVal EndRange As Object) As ParameterRangeV alue
              > Dim paramRangeValue As ParameterRangeV alue
              >
              > paramRangeValue = New ParameterRangeV alue
              >
              > paramRangeValue .StartValue = StartRange
              > paramRangeValue .EndValue = EndRange
              >
              > Return paramRangeValue
              > End Function
              >
              > #End Region
              >
              > #Region "Report Export"
              >
              > Private Function GetExportOption s(ByVal UniqueFormat As FileNameFormats ,
              > ByVal ExportOptions As CrystalDecision s.Shared.Export Options) As
              > CrystalDecision s.Shared.Export Options
              >
              > Dim myExportFile As String
              > Dim myExportOptions As CrystalDecision s.Shared.Export Options
              > Dim myDiskFileDesti nationOptions As
              > CrystalDecision s.Shared.DiskFi leDestinationOp tions
              >
              > Try
              >
              > Select Case UniqueFormat
              > Case FileNameFormats .SessionID
              > myExportFile = Session.Session ID.ToString
              > Case FileNameFormats .GUIDDashes
              > myExportFile = System.Guid.New Guid.ToString(" D")
              > Case FileNameFormats .GUIDNoDashes
              > myExportFile = System.Guid.New Guid.ToString(" N")
              > End Select
              >
              > myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
              > String.Format(" PDF_{0}.pdf", myExportFile))
              >
              > myDiskFileDesti nationOptions = New
              > CrystalDecision s.Shared.DiskFi leDestinationOp tions
              > myDiskFileDesti nationOptions.D iskFileName = myExportFile
              >
              > myExportOptions = ExportOptions
              >
              > With myExportOptions
              > .DestinationOpt ions = myDiskFileDesti nationOptions
              > .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
              > .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
              > End With
              >
              > Catch ex As Exception
              >
              > Dim exc As System.Applicat ionException
              > exc = New System.Applicat ionException("U nable to prepare export
              > options.", ex)
              > Throw exc
              >
              > End Try
              >
              > Return myExportOptions
              >
              > End Function
              >
              > Private Function GetExportRoot(B yVal FromApplication As Boolean) As
              > String
              >
              > Dim strExportRoot As String
              >
              > If FromApplication Then
              > Try
              > Application.loc k()
              > strExportRoot = Application("Re portExportRoot" )
              > Catch ex As Exception
              > Dim exc As ApplicationExce ption
              > exc = New ApplicationExce ption("Unable to lock Web Application for
              > read.", ex)
              > Throw exc
              > Finally
              > Application.unl ock()
              > End Try
              > Else
              > strExportRoot = Session("Report ExportRoot")
              > End If
              >
              > Return strExportRoot
              >
              > End Function
              >
              > #End Region
              >
              > #Region "Navigation Implementation"
              >
              > Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles cmdPrint.Click
              >
              > Response.ClearC ontent()
              > Response.ClearH eaders()
              > Response.Conten tType = "applicatio n/pdf"
              >
              > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              > String)
              >
              > Response.WriteF ile(myExportFil e)
              > Response.Flush( )
              > Response.Close( )
              >
              > System.IO.File. Delete(myExport File)
              >
              > End Sub
              >
              > Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles cmdEerste.Click
              > crViewer.ShowFi rstPage()
              > End Sub
              >
              > Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles cmdLaatste.Clic k
              > crViewer.ShowLa stPage()
              > End Sub
              >
              > Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles cmdTerug.Click
              > crViewer.ShowPr eviousPage()
              > End Sub
              >
              > Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles cmdVerder.Click
              > crViewer.ShowNe xtPage()
              > End Sub
              >
              > Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
              > As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
              > crViewer.Zoom(d rpZoom.Selected Item.Value)
              > End Sub
              >
              > #End Region
              >
              >
              > "Alison Givens" <info@cross-it.nl> wrote in message
              > news:%23RW%23bs jNGHA.2124@TK2M SFTNGP14.phx.gb l...[color=green][color=darkred]
              >>> Perhaps you could share your resulting code for comparison? Did you see
              >>> that I suggested the error in your code was
              >>>
              >>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call
              >>> this statement once (Effectively 2344) but you wanted two values.[/color]
              >>
              >> To get the thing going, it would be enough for me at first to know how to
              >> call the statement twice, so the other value is forwarded too.
              >> (btw, these two values will be SessionObjects two, but I did it hardcoded
              >> for testing)
              >> Best would be ofcourse that I learn to do it 'clean' of course. I am a
              >> real newbee at this.
              >>
              >> Here is the rest of my code:
              >>
              >> Imports CrystalDecision s.CrystalReport s.Engine
              >> Imports CrystalDecision s.CrystalReport s.Engine.Report Document
              >> Imports CrystalDecision s.Shared
              >> Imports System.IO
              >>
              >>
              >> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles MyBase.Init
              >> 'CODEGEN: This method call is required by the Web Form Designer
              >> 'Do not modify it using the code editor.
              >> InitializeCompo nent()
              >>
              >>
              >>
              >> Dim myReport As RapportAIRCOSto ringen
              >> Dim paramFields As ParameterFields
              >> Dim paramField As ParameterField
              >>
              >> Dim BeginPeriode As String
              >> Dim EindPeriode As String
              >>
              >> 'Todo wrap everything in try
              >> paramFields = New ParameterFields
              >>
              >> Try
              >> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
              >> EindPeriode = Request.QuerySt ring("EindPerio de")
              >> Catch ex As Exception
              >> Dim exCustom As ApplicationExce ption
              >> exCustom = New ApplicationExce ption("Unable to parse Query
              >> Paramaters.", ex)
              >> Throw exCustom
              >> End Try
              >>
              >> 'Todo wrap in try
              >> paramField = CreateParameter ("FiliaalKeuze" )
              >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
              >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
              >> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
              >>
              >>
              >> 'Todo wrap in try
              >> paramField = CreateParameter ("Periode")
              >>
              >> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
              >> EindPeriode))
              >> myReport.SetPar ameterValue("Pe riode", paramField)
              >>
              >>
              >> crViewer.Report Source = myReport
              >>
              >>
              >> 'exporteren to pdf
              >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
              >> Dim myDiskFileDesti nationOptions As
              >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
              >> Dim myExportFile As String
              >>
              >>
              >>
              >> myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
              >> Session.Session ID.ToString & ".pdf"
              >> myDiskFileDesti nationOptions = New
              >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
              >> myDiskFileDesti nationOptions.D iskFileName = myExportFile
              >> myExportOptions = myReport.Export Options
              >> With myExportOptions
              >> .DestinationOpt ions = myDiskFileDesti nationOptions
              >> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
              >> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
              >> End With
              >>
              >> Try
              >> myReport.Export ()
              >> Catch err As Exception
              >> Response.Write( "<BR>")
              >> Response.Write( err.Message.ToS tring)
              >> End Try
              >>
              >> Session("export bestand") = myExportFile
              >> End Sub
              >>
              >> #End Region
              >>
              >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles MyBase.Load
              >> 'Put user code to initialize the page here
              >> End Sub
              >> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles cmdPrint.Click
              >> Response.ClearC ontent()
              >> Response.ClearH eaders()
              >> Response.Conten tType = "applicatio n/pdf"
              >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              >> String)
              >>
              >> Response.WriteF ile(myExportFil e)
              >> Response.Flush( )
              >> Response.Close( )
              >>
              >> System.IO.File. Delete(myExport File)
              >> End Sub
              >>
              >> Private Function CreateParameter (ByVal ParameterName As String) As
              >> ParameterField( )
              >> Dim paramField As ParameterField
              >>
              >> paramField = New ParameterField
              >> paramField.Para meterFieldName = ParameterName
              >>
              >> 'Return paramField
              >>
              >> End Function
              >>
              >> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
              >> As ParameterDiscre teValue()
              >>
              >> Dim paramDiscreteVa lue As ParameterDiscre teValue
              >> paramDiscreteVa lue = New ParameterDiscre teValue
              >> paramDiscreteVa lue = Value
              >>
              >> 'Return paramDiscreteVa lue
              >>
              >> End Function
              >>
              >> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
              >> ByVal EndRange As Object) As ParameterRangeV alue
              >> Dim paramRangeValue As ParameterRangeV alue
              >>
              >> paramRangeValue = New ParameterRangeV alue
              >>
              >> paramRangeValue .StartValue = StartRange
              >> paramRangeValue .EndValue = EndRange
              >>
              >> Return paramRangeValue
              >> End Function
              >>
              >>
              >> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles cmdEerste.Click
              >> crViewer.ShowFi rstPage()
              >> End Sub
              >>
              >> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles cmdLaatste.Clic k
              >> crViewer.ShowLa stPage()
              >> End Sub
              >>
              >> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles cmdTerug.Click
              >> crViewer.ShowPr eviousPage()
              >> End Sub
              >>
              >> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
              >> System.EventArg s) Handles cmdVerder.Click
              >> crViewer.ShowNe xtPage()
              >> End Sub
              >>
              >> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
              >> e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
              >> crViewer.Zoom(d rpZoom.Selected Item.Value)
              >> End Sub
              >> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
              >> System.EventArg s) Handles MyBase.Unload
              >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
              >> String)
              >>
              >> System.IO.File. Delete(myExport File)
              >> End Sub
              >> End Class
              >>
              >>
              >>
              >>
              >>
              >>[color=darkred]
              >>>
              >>> "Alison Givens" <info@cross-it.nl> wrote in message
              >>> news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...
              >>>> When I use your solution I get blue lines under the text like this
              >>>>
              >>>> paramField = CreateParamater ("FiliaalKeuze" )
              >>>> The text is:
              >>>> Value of type '1 dimensional array of
              >>>> CrystalDecision s.Shared.Parame terField' cannot be converted
              >>>> to 'Crystal.Decisi ons.Shared.Para meterField'
              >>>>
              >>>> Return paramField
              >>>> The text is:
              >>>> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
              >>>> converted
              >>>> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
              >>>>
              >>>> Same for
              >>>> paramField = CreateParamater ("Periode")
              >>>> Return paramDiscreteVa lue
              >>>>
              >>>> Any idea what causes this?
              >>>>
              >>>> Alison
              >>>>
              >>>>
              >>>> "AMDRIT" <amdrit@hotmail .com> wrote in message
              >>>> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...
              >>>>> Wow, you do all that for Crystal Reports? What is
              >>>>> RapportAIRCOSto ringen?
              >>>>>
              >>>>>
              >>>>> Here is all I do for CR
              >>>>>
              >>>>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
              >>>>>
              >>>>> x.Load(sReportP ath) 'Reports are not embedded resources
              >>>>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
              >>>>> Paramaters
              >>>>> x.SetParameterV alue("Paramater 2", Paramaters(2))
              >>>>> x.SetDataSource (mydata) 'Strongly Typed Datasets
              >>>>>
              >>>>> Me.CrystalRepor tViewer1.Report Source = x
              >>>>> Me.CrystalRepor tViewer1.PrintR eport()
              >>>>>
              >>>>>
              >>>>> 'Now to answer your question about your code, hmm
              >>>>>
              >>>>> Ok, first
              >>>>>
              >>>>> Never --> Dim x as new object
              >>>>> 'This is silly, lazy and unprofessional. So if you are in high
              >>>>> school, keep the course.
              >>>>>
              >>>>>
              >>>>> Instead --> Dim x as object
              >>>>> Set x = new object
              >>>>> 'Reserve your space and contract
              >>>>> 'Then make use of it.
              >>>>>
              >>>>> I think this is your problem
              >>>>>
              >>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
              >>>>>
              >>>>> Why are you setting the crView paramaters and the myReport paramaters?
              >>>>> -->crViewer.Param eterFieldInfo = paramFields
              >>>>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
              >>>>>
              >>>>> I think that myReport is the only think that needs to be set
              >>>>>
              >>>>>
              >>>>> I had to spent time reading your code to understand what you were
              >>>>> doing.
              >>>>>
              >>>>> Here is an attempt to clean it up.
              >>>>>
              >>>>> Private Sub TestIT()
              >>>>>
              >>>>> Dim myReport As RapportAIRCOSto ringen
              >>>>> Dim paramFields As ParameterFields
              >>>>> Dim paramField As ParameterField
              >>>>>
              >>>>> Dim BeginPeriode As String
              >>>>> Dim EindPeriode As String
              >>>>>
              >>>>> 'Todo wrap everything in try
              >>>>> paramFields = New ParameterFields
              >>>>>
              >>>>> Try
              >>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
              >>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
              >>>>> Catch ex As Exception
              >>>>> Dim exCustom As ApplicationExce ption
              >>>>> exCustom = New ApplicationExce ption("Unable to parse Query
              >>>>> Paramaters.", ex)
              >>>>> Throw exCustom
              >>>>> End Try
              >>>>>
              >>>>> 'Todo wrap in try
              >>>>> paramField = CreateParamater ("FiliaalKeuze" )
              >>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
              >>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
              >>>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
              >>>>> 'paramFields.Ad d(paramField) --> Not needed
              >>>>>
              >>>>> 'Todo wrap in try
              >>>>> paramField = CreateParamater ("Periode")
              >>>>>
              >>>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
              >>>>> EindPeriode))
              >>>>> myReport.SetPar ameterValue("Pe riode", paramField)
              >>>>> 'paramFields.Ad d(paramField)--> Not needed
              >>>>>
              >>>>> 'Todo wrap in try, i don't think you need this
              >>>>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
              >>>>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
              >>>>>
              >>>>> 'Todo, determine if we need this step; I don't think you do
              >>>>> 'crViewer.Param eterFieldInfo = paramFields
              >>>>>
              >>>>> crViewer.Report Source = myReport
              >>>>>
              >>>>> End Sub
              >>>>>
              >>>>> Private Function CreateParamater (ByVal ParamaterName As String) As
              >>>>> ParameterField
              >>>>> Dim paramField As ParameterField
              >>>>>
              >>>>> paramField = New ParameterField
              >>>>> paramField.Para meterFieldName = ParamaterName
              >>>>>
              >>>>> Return paramField
              >>>>>
              >>>>> End Function
              >>>>>
              >>>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
              >>>>> As ParameterDiscre teValue
              >>>>>
              >>>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
              >>>>> paramDiscreteVa lue = New ParameterDiscre teValue
              >>>>> paramDiscreteVa lue = Value
              >>>>>
              >>>>> Return paramDiscreteVa lue
              >>>>>
              >>>>> End Function
              >>>>>
              >>>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
              >>>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
              >>>>> Dim paramRangeValue As ParameterRangeV alue
              >>>>>
              >>>>> paramRangeValue = New ParameterRangeV alue
              >>>>>
              >>>>> paramRangeValue .StartValue = StartRange
              >>>>> paramRangeValue .EndValue = EndRange
              >>>>>
              >>>>> Return paramRangeValue
              >>>>> End Function
              >>>>>
              >>>>> "Alison Givens" <info@cross-it.nl> wrote in message
              >>>>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
              >>>>>> ...... that nobody knows the answer.
              >>>>>> I can't imagine that I am the only one that uses parameters in CR.
              >>>>>>
              >>>>>> So, my question again:
              >>>>>>
              >>>>>> I have the following problem.
              >>>>>> (VB.NET 2003 with CR)
              >>>>>>
              >>>>>> I have a report with a multiple-value discrete value and a
              >>>>>> rangevalue.
              >>>>>> The report shows fine in the viewer, but when I hit the export to pdf
              >>>>>> button, it only uses one of two discrete values.
              >>>>>>
              >>>>>> This is the code:
              >>>>>> Dim BeginPeriode As String
              >>>>>> Dim EindPeriode As String
              >>>>>>
              >>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
              >>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
              >>>>>>
              >>>>>> Dim myReport As New RapportAIRCOSto ringen
              >>>>>>
              >>>>>> Dim paramFields As New ParameterFields
              >>>>>> Dim paramField As New ParameterField
              >>>>>> Dim discreteVal As New ParameterDiscre teValue
              >>>>>> Dim rangeVal As New ParameterRangeV alue
              >>>>>>
              >>>>>> paramField.Para meterFieldName = "FiliaalKeu ze"
              >>>>>> discreteVal.Val ue = "2044"
              >>>>>> paramField.Curr entValues.Add(d iscreteVal)
              >>>>>>
              >>>>>> discreteVal = New ParameterDiscre teValue
              >>>>>> discreteVal.Val ue = "2344"
              >>>>>> paramField.Curr entValues.Add(d iscreteVal)
              >>>>>>
              >>>>>> paramFields.Add (paramField)
              >>>>>>
              >>>>>> paramField = New ParameterField
              >>>>>>
              >>>>>> paramField.Para meterFieldName = "Periode"
              >>>>>>
              >>>>>> rangeVal.StartV alue = BeginPeriode
              >>>>>> rangeVal.EndVal ue = EindPeriode
              >>>>>> paramField.Curr entValues.Add(r angeVal)
              >>>>>>
              >>>>>> paramFields.Add (paramField)
              >>>>>>
              >>>>>> crViewer.Parame terFieldInfo = paramFields
              >>>>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
              >>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
              >>>>>> crViewer.Report Source = myReport
              >>>>>>
              >>>>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
              >>>>>> It goes wrong with the discrete value. It only sees the second value
              >>>>>> I
              >>>>>> entered and not the first.
              >>>>>> How can I get this going?
              >>>>>>
              >>>>>>
              >>>>>> Kind regards,
              >>>>>> Alison
              >>>>>>
              >>>>>>
              >>>>>>
              >>>>>>
              >>>>>
              >>>>>
              >>>>
              >>>>
              >>>
              >>>[/color]
              >>
              >>[/color]
              >
              >[/color]


              Comment

              • AMDRIT

                #8
                Re: How is it possible ...

                Good morning,

                I just realized you keep different hours than me. Please keep in mind that
                all the code that I have submitted to you is wholly untested and therefore
                the jist of what I was conveying should be taken into context. I attempt to
                answer your direct question before going off onto a tangent.

                1. You need a function named GetSessionValue
                The signature would look like: GetSessionValue (KeyName as string) as
                object and all it would do is return Session.Item(Ke yName)

                2. Correct the line
                myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                String.Format(" PDF_{0}.pdf", myExportFile))
                to
                myExportFile = System.IO.Path. Combine(GetExpo rtRoot(false),
                String.Format(" PDF_{0}.pdf", myExportFile))
                or
                myExportFile = System.IO.Path. Combine(GetExpo rtRoot(true),
                String.Format(" PDF_{0}.pdf", myExportFile))

                If you are to use the function GetExportRoot, then you must set up your
                global.asax to set a global variable to hold ReportExportRoo t in
                Application_OnS tart, and if you want each session to get a copy of that
                value in the global.asax Session_OnStart , have it read the Application
                variable.

                The goal here is to store environmental setting information out of compiled
                code. It's more work to set it up, but will not require you to compile the
                application everytime you want to make a change.

                ideal uses for the web config (DbConnection, ServerLocations , FileShares,
                WebService URLs)

                keep in mind though, each time you modify the webconfig, it spawns a new
                instance of your application. Existing users (those already connected) will
                not see your changes and will be orphaned from your intended solution.
                Changes to the web config, once in production, should be treated as a bug
                fix or enhancement that required replacement of binaries.

                Example

                In your web.config | appsettings section, create a key pair

                <Add key="ReportExpo rtRoot" Value = "\\192.168.2.10 6\syn2sql$\PDF_ " />
                for more information on appsettings see:
                ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpgenref/html/gngrfappsetting selement.htm

                in your application's global.asax on Application_OnS tart
                ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/vbcon/html/vbconPageApplic ationContext.ht m
                ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpguide/html/cpcontheglobala saxfile.htm

                sub application_ons tart()
                Dim ReportExportRoo t as string
                ReportExportRoo t =
                System.Configur ation.Configura tionSettings.Ap pSettings("Repo rtExportRoot")
                Application.Loc k
                Application("Re portExportRoot" ) = ReportExportRoo t
                Application.Unl ock
                end sub

                in you application's global.asax on Session_OnStart
                sub Session_Onstart ()
                Dim ReportExportRoo t as string
                Application.Loc k
                ReportExportRoo t = ctype(Applicati on("ReportExpor tRoot"),string)
                Application.Unl ock
                Session.item("R eportExportRoot ") = ReportExportRoo t
                end sub

                "Alison Givens" <info@cross-it.nl> wrote in message
                news:OTYvuJsNGH A.3164@TK2MSFTN GP11.phx.gbl...[color=blue]
                >I used the code as you suggested, but again I get blue underlines.
                > First with every GetSessionValue ,it has a blue underline:
                > Name GetSessionValue is not declared
                >
                > and the other blue underline is GetExportRoot
                > myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                > String.Format(" PDF_{0}.pdf", myExportFile))
                > Says:Argument not specified for parameter 'FromApplicatio n' of
                > 'Private Function GetExportRoot(F romApplication As Boolean) As String'.
                >
                > I pasted the code again for your convenience.
                >
                >
                >
                > Private Enum FileNameFormats
                > SessionID = 0
                > GUIDDashes = 1
                > GUIDNoDashes = 2
                > End Enum
                >
                >
                > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles MyBase.Init
                > 'CODEGEN: This method call is required by the Web Form Designer
                > 'Do not modify it using the code editor.
                > InitializeCompo nent()
                > Dim myReport As RapportAIRCOSto ringen
                > Dim myExportOptions As CrystalDecision s.Shared.Export Options
                >
                > Try
                >
                > Try
                > PrepareReport(m yReport)
                > Catch ex As Exception
                > Dim exc As ApplicationExce ption
                > exc = New ApplicationExce ption("Unable to prepare report.",
                > ex)
                > Throw exc
                > End Try
                >
                > Try
                > 'exporteren to pdf
                > myExportOptions =
                > GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                > CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                > myReport.Export ()
                >
                > Catch ex As Exception
                > Dim exc As ApplicationExce ption
                > exc = New ApplicationExce ption("Unable to export report.",
                > ex)
                > Throw exc
                > End Try
                >
                > crViewer.Report Source = myReport
                >
                > Session("export bestand") =
                > CType(myExportO ptions.Destinat ionOptions,
                > CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                >
                > Catch err As Exception
                > Response.Write( "<BR>")
                > Response.Write( err.Message.ToS tring)
                > End Try
                >
                >
                >
                >
                > End Sub
                >
                > #End Region
                >
                > #Region "Page Implementation"
                >
                > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles MyBase.Load
                > 'Put user code to initialize the page here
                > End Sub
                >
                > Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                > System.EventArg s) Handles MyBase.Unload
                > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                > String)
                >
                > System.IO.File. Delete(myExport File)
                > End Sub
                >
                > #End Region
                >
                > #Region "Report Setup"
                >
                > Private Sub PrepareReport(B yVal myReport As
                > CrystalDecision s.CrystalReport s.Engine.Report Document)
                >
                > Dim paramFields As ParameterFields
                > Dim paramField As ParameterField
                >
                > Const SessionExecptio n As String = "Unable to read session
                > objects."
                >
                > Try
                >
                > paramFields = New ParameterFields
                > Try
                > paramField = CreateParameter ("FiliaalKeuze" )
                >
                > paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                >
                > paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                >
                > Catch ex As Exception
                > Dim exc As System.Applicat ionException
                > exc = New System.Applicat ionException(Se ssionExecption, ex)
                > Throw exc
                > End Try
                >
                > myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                >
                > Try
                > 'Todo wrap in try
                > paramField = CreateParameter ("Periode")
                >
                > paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                > GetSessionValue ("EindPeriode") ))
                > Catch ex As Exception
                > Dim exc As System.Applicat ionException
                > exc = New System.Applicat ionException(Se ssionExecption, ex)
                > Throw exc
                > End Try
                >
                > myReport.SetPar ameterValue("Pe riode", paramField)
                >
                > Catch ex As Exception
                >
                > Dim exc As System.Applicat ionException
                > exc = New System.Applicat ionException("U nable to set
                > paramatervalue. ", ex)
                > Throw exc
                >
                > End Try
                >
                >
                > End Sub
                >
                > Private Function CreateParameter (ByVal ParameterName As String) As
                > ParameterField
                > Dim paramField As ParameterField
                >
                > paramField = New ParameterField
                > paramField.Para meterFieldName = ParameterName
                >
                > Return paramField
                >
                > End Function
                >
                > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                > ParameterDiscre teValue
                >
                > Dim paramDiscreteVa lue As ParameterDiscre teValue
                > paramDiscreteVa lue = New ParameterDiscre teValue
                > paramDiscreteVa lue = Value
                >
                > Return paramDiscreteVa lue
                >
                > End Function
                >
                > Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                > ByVal EndRange As Object) As ParameterRangeV alue
                > Dim paramRangeValue As ParameterRangeV alue
                >
                > paramRangeValue = New ParameterRangeV alue
                >
                > paramRangeValue .StartValue = StartRange
                > paramRangeValue .EndValue = EndRange
                >
                > Return paramRangeValue
                > End Function
                >
                > #End Region
                >
                > #Region "Report Export"
                >
                > Private Function GetExportOption s(ByVal UniqueFormat As
                > FileNameFormats , ByVal ExportOptions As
                > CrystalDecision s.Shared.Export Options) As
                > CrystalDecision s.Shared.Export Options
                >
                > Dim myExportFile As String
                > Dim myExportOptions As CrystalDecision s.Shared.Export Options
                > Dim myDiskFileDesti nationOptions As
                > CrystalDecision s.Shared.DiskFi leDestinationOp tions
                >
                > Try
                >
                > Select Case UniqueFormat
                > Case FileNameFormats .SessionID
                > myExportFile = Session.Session ID.ToString
                > Case FileNameFormats .GUIDDashes
                > myExportFile = System.Guid.New Guid.ToString(" D")
                > Case FileNameFormats .GUIDNoDashes
                > myExportFile = System.Guid.New Guid.ToString(" N")
                > End Select
                >
                > myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                > String.Format(" PDF_{0}.pdf", myExportFile))
                >
                > myDiskFileDesti nationOptions = New
                > CrystalDecision s.Shared.DiskFi leDestinationOp tions
                > myDiskFileDesti nationOptions.D iskFileName = myExportFile
                >
                > myExportOptions = ExportOptions
                >
                > With myExportOptions
                > .DestinationOpt ions = myDiskFileDesti nationOptions
                > .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                > .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                > End With
                >
                > Catch ex As Exception
                >
                > Dim exc As System.Applicat ionException
                > exc = New System.Applicat ionException("U nable to prepare export
                > options.", ex)
                > Throw exc
                >
                > End Try
                >
                > Return myExportOptions
                >
                > End Function
                >
                > Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                > String
                >
                > Dim strExportRoot As String
                >
                > If FromApplication Then
                > Try
                > Application.Loc k()
                > strExportRoot = Application("Re portExportRoot" )
                > Catch ex As Exception
                > Dim exc As ApplicationExce ption
                > exc = New ApplicationExce ption("Unable to lock Web
                > Application for read.", ex)
                > Throw exc
                > Finally
                > Application.UnL ock()
                > End Try
                > Else
                > strExportRoot = Session("Report ExportRoot")
                > End If
                >
                > Return strExportRoot
                >
                > End Function
                >
                > #End Region
                >
                > #Region "Navigation Implementation"
                >
                > Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles cmdPrint.Click
                >
                > Response.ClearC ontent()
                > Response.ClearH eaders()
                > Response.Conten tType = "applicatio n/pdf"
                >
                > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                > String)
                >
                > Response.WriteF ile(myExportFil e)
                > Response.Flush( )
                > Response.Close( )
                >
                > System.IO.File. Delete(myExport File)
                >
                > End Sub
                >
                > Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles cmdEerste.Click
                > crViewer.ShowFi rstPage()
                > End Sub
                >
                > Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles cmdLaatste.Clic k
                > crViewer.ShowLa stPage()
                > End Sub
                >
                > Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles cmdTerug.Click
                > crViewer.ShowPr eviousPage()
                > End Sub
                >
                > Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                > System.EventArg s) Handles cmdVerder.Click
                > crViewer.ShowNe xtPage()
                > End Sub
                >
                > Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
                > As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                > crViewer.Zoom(d rpZoom.Selected Item.Value)
                > End Sub
                >
                > #End Region
                >
                >
                > End Class
                >
                >
                >
                >
                > "AMDRIT" <amdrit@hotmail .com> wrote in message
                > news:OpMDndkNGH A.2064@TK2MSFTN GP09.phx.gbl...[color=green]
                >> Ok, first the isue you were having with the "Blue lines" is:
                >>
                >> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                >> ParameterDiscre teValue()
                >> --> Retun type is expecting an array of ParameterDiscre teValue
                >>
                >> it should be
                >>
                >> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                >> ParameterDiscre teValue
                >> --> Retun type is expecting an single ParameterDiscre teValue
                >>
                >> Second (Mostly because I was bored and also because I am still a novice),
                >> I have altered your code yet again.
                >>
                >>
                >> Private Enum FileNameFormats
                >> SessionID = 0
                >> GUIDDashes = 1
                >> GUIDNoDashes = 2
                >> End Enum
                >>
                >> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles MyBase.Init
                >> 'CODEGEN: This method call is required by the Web Form Designer
                >> 'Do not modify it using the code editor.
                >> InitializeCompo nent()
                >>
                >> Dim myReport As RapportAIRCOSto ringen
                >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                >>
                >> Try
                >>
                >> Try
                >> PrepareReport(m yReport)
                >> Catch ex As Exception
                >> Dim exc As ApplicationExce ption
                >> exc = New ApplicationExce ption("Unable to prepare report.", ex)
                >> Throw exc
                >> End Try
                >>
                >> Try
                >> 'exporteren to pdf
                >> myExportOptions = GetExportOption s(FileNameForma ts.GUIDNoDashes ,
                >> CType(myReport,
                >> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                >> myReport.Export ()
                >>
                >> Catch ex As Exception
                >> Dim exc As ApplicationExce ption
                >> exc = New ApplicationExce ption("Unable to export report.", ex)
                >> Throw exc
                >> End Try
                >>
                >> crViewer.Report Source = myReport
                >>
                >> Session("export bestand") = CType(myExportO ptions.Destinat ionOptions,
                >> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                >>
                >> Catch err As Exception
                >> Response.Write( "<BR>")
                >> Response.Write( err.Message.ToS tring)
                >> End Try
                >>
                >> End Sub
                >>
                >> #Region "Page Implementation"
                >>
                >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles MyBase.Load
                >> 'Put user code to initialize the page here
                >> End Sub
                >>
                >> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                >> System.EventArg s) Handles MyBase.Unload
                >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                >> String)
                >>
                >> System.IO.File. Delete(myExport File)
                >> End Sub
                >>
                >> #End Region
                >>
                >> #Region "Report Setup"
                >>
                >> Private Sub PrepareReport(B yVal myReport As
                >> CrystalDecision s.CrystalReport s.Engine.Report Document)
                >>
                >> Dim paramFields As ParameterFields
                >> Dim paramField As ParameterField
                >>
                >> Const SessionExecptio n As String = "Unable to read session objects."
                >>
                >> Try
                >>
                >> paramFields = New ParameterFields
                >> Try
                >> paramField = CreateParameter ("FiliaalKeuze" )
                >>
                >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                >>
                >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                >> Catch ex As Exception
                >> Dim exc As System.Applicat ionException
                >> exc = New System.Applicat ionException(Se ssionExecption, ex)
                >> Throw exc
                >> End Try
                >>
                >> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                >>
                >> Try
                >> 'Todo wrap in try
                >> paramField = CreateParameter ("Periode")
                >>
                >> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                >> GetSessionValue ("EindPeriode") ))
                >> Catch ex As Exception
                >> Dim exc As System.Applicat ionException
                >> exc = New System.Applicat ionException(Se ssionExecption, ex)
                >> Throw exc
                >> End Try
                >>
                >> myReport.SetPar ameterValue("Pe riode", paramField)
                >>
                >> Catch ex As Exception
                >>
                >> Dim exc As System.Applicat ionException
                >> exc = New System.Applicat ionException("U nable to set paramater
                >> value.", ex)
                >> Throw exc
                >>
                >> End Try
                >>
                >>
                >> End Sub
                >>
                >> Private Function CreateParameter (ByVal ParameterName As String) As
                >> ParameterField
                >> Dim paramField As ParameterField
                >>
                >> paramField = New ParameterField
                >> paramField.Para meterFieldName = ParameterName
                >>
                >> Return paramField
                >>
                >> End Function
                >>
                >> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                >> ParameterDiscre teValue()
                >>
                >> Dim paramDiscreteVa lue As ParameterDiscre teValue
                >> paramDiscreteVa lue = New ParameterDiscre teValue
                >> paramDiscreteVa lue = Value
                >>
                >> 'Return paramDiscreteVa lue
                >>
                >> End Function
                >>
                >> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                >> ByVal EndRange As Object) As ParameterRangeV alue
                >> Dim paramRangeValue As ParameterRangeV alue
                >>
                >> paramRangeValue = New ParameterRangeV alue
                >>
                >> paramRangeValue .StartValue = StartRange
                >> paramRangeValue .EndValue = EndRange
                >>
                >> Return paramRangeValue
                >> End Function
                >>
                >> #End Region
                >>
                >> #Region "Report Export"
                >>
                >> Private Function GetExportOption s(ByVal UniqueFormat As FileNameFormats ,
                >> ByVal ExportOptions As CrystalDecision s.Shared.Export Options) As
                >> CrystalDecision s.Shared.Export Options
                >>
                >> Dim myExportFile As String
                >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                >> Dim myDiskFileDesti nationOptions As
                >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                >>
                >> Try
                >>
                >> Select Case UniqueFormat
                >> Case FileNameFormats .SessionID
                >> myExportFile = Session.Session ID.ToString
                >> Case FileNameFormats .GUIDDashes
                >> myExportFile = System.Guid.New Guid.ToString(" D")
                >> Case FileNameFormats .GUIDNoDashes
                >> myExportFile = System.Guid.New Guid.ToString(" N")
                >> End Select
                >>
                >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                >> String.Format(" PDF_{0}.pdf", myExportFile))
                >>
                >> myDiskFileDesti nationOptions = New
                >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                >> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                >>
                >> myExportOptions = ExportOptions
                >>
                >> With myExportOptions
                >> .DestinationOpt ions = myDiskFileDesti nationOptions
                >> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                >> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                >> End With
                >>
                >> Catch ex As Exception
                >>
                >> Dim exc As System.Applicat ionException
                >> exc = New System.Applicat ionException("U nable to prepare export
                >> options.", ex)
                >> Throw exc
                >>
                >> End Try
                >>
                >> Return myExportOptions
                >>
                >> End Function
                >>
                >> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                >> String
                >>
                >> Dim strExportRoot As String
                >>
                >> If FromApplication Then
                >> Try
                >> Application.loc k()
                >> strExportRoot = Application("Re portExportRoot" )
                >> Catch ex As Exception
                >> Dim exc As ApplicationExce ption
                >> exc = New ApplicationExce ption("Unable to lock Web Application for
                >> read.", ex)
                >> Throw exc
                >> Finally
                >> Application.unl ock()
                >> End Try
                >> Else
                >> strExportRoot = Session("Report ExportRoot")
                >> End If
                >>
                >> Return strExportRoot
                >>
                >> End Function
                >>
                >> #End Region
                >>
                >> #Region "Navigation Implementation"
                >>
                >> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles cmdPrint.Click
                >>
                >> Response.ClearC ontent()
                >> Response.ClearH eaders()
                >> Response.Conten tType = "applicatio n/pdf"
                >>
                >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                >> String)
                >>
                >> Response.WriteF ile(myExportFil e)
                >> Response.Flush( )
                >> Response.Close( )
                >>
                >> System.IO.File. Delete(myExport File)
                >>
                >> End Sub
                >>
                >> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles cmdEerste.Click
                >> crViewer.ShowFi rstPage()
                >> End Sub
                >>
                >> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles cmdLaatste.Clic k
                >> crViewer.ShowLa stPage()
                >> End Sub
                >>
                >> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles cmdTerug.Click
                >> crViewer.ShowPr eviousPage()
                >> End Sub
                >>
                >> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                >> System.EventArg s) Handles cmdVerder.Click
                >> crViewer.ShowNe xtPage()
                >> End Sub
                >>
                >> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
                >> As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                >> crViewer.Zoom(d rpZoom.Selected Item.Value)
                >> End Sub
                >>
                >> #End Region
                >>
                >>
                >> "Alison Givens" <info@cross-it.nl> wrote in message
                >> news:%23RW%23bs jNGHA.2124@TK2M SFTNGP14.phx.gb l...[color=darkred]
                >>>> Perhaps you could share your resulting code for comparison? Did you
                >>>> see that I suggested the error in your code was
                >>>>
                >>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call
                >>>> this statement once (Effectively 2344) but you wanted two values.
                >>>
                >>> To get the thing going, it would be enough for me at first to know how
                >>> to call the statement twice, so the other value is forwarded too.
                >>> (btw, these two values will be SessionObjects two, but I did it
                >>> hardcoded for testing)
                >>> Best would be ofcourse that I learn to do it 'clean' of course. I am a
                >>> real newbee at this.
                >>>
                >>> Here is the rest of my code:
                >>>
                >>> Imports CrystalDecision s.CrystalReport s.Engine
                >>> Imports CrystalDecision s.CrystalReport s.Engine.Report Document
                >>> Imports CrystalDecision s.Shared
                >>> Imports System.IO
                >>>
                >>>
                >>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles MyBase.Init
                >>> 'CODEGEN: This method call is required by the Web Form Designer
                >>> 'Do not modify it using the code editor.
                >>> InitializeCompo nent()
                >>>
                >>>
                >>>
                >>> Dim myReport As RapportAIRCOSto ringen
                >>> Dim paramFields As ParameterFields
                >>> Dim paramField As ParameterField
                >>>
                >>> Dim BeginPeriode As String
                >>> Dim EindPeriode As String
                >>>
                >>> 'Todo wrap everything in try
                >>> paramFields = New ParameterFields
                >>>
                >>> Try
                >>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                >>> EindPeriode = Request.QuerySt ring("EindPerio de")
                >>> Catch ex As Exception
                >>> Dim exCustom As ApplicationExce ption
                >>> exCustom = New ApplicationExce ption("Unable to parse Query
                >>> Paramaters.", ex)
                >>> Throw exCustom
                >>> End Try
                >>>
                >>> 'Todo wrap in try
                >>> paramField = CreateParameter ("FiliaalKeuze" )
                >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                >>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                >>>
                >>>
                >>> 'Todo wrap in try
                >>> paramField = CreateParameter ("Periode")
                >>>
                >>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                >>> EindPeriode))
                >>> myReport.SetPar ameterValue("Pe riode", paramField)
                >>>
                >>>
                >>> crViewer.Report Source = myReport
                >>>
                >>>
                >>> 'exporteren to pdf
                >>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                >>> Dim myDiskFileDesti nationOptions As
                >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                >>> Dim myExportFile As String
                >>>
                >>>
                >>>
                >>> myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
                >>> Session.Session ID.ToString & ".pdf"
                >>> myDiskFileDesti nationOptions = New
                >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                >>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                >>> myExportOptions = myReport.Export Options
                >>> With myExportOptions
                >>> .DestinationOpt ions = myDiskFileDesti nationOptions
                >>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                >>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                >>> End With
                >>>
                >>> Try
                >>> myReport.Export ()
                >>> Catch err As Exception
                >>> Response.Write( "<BR>")
                >>> Response.Write( err.Message.ToS tring)
                >>> End Try
                >>>
                >>> Session("export bestand") = myExportFile
                >>> End Sub
                >>>
                >>> #End Region
                >>>
                >>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles MyBase.Load
                >>> 'Put user code to initialize the page here
                >>> End Sub
                >>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles cmdPrint.Click
                >>> Response.ClearC ontent()
                >>> Response.ClearH eaders()
                >>> Response.Conten tType = "applicatio n/pdf"
                >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                >>> String)
                >>>
                >>> Response.WriteF ile(myExportFil e)
                >>> Response.Flush( )
                >>> Response.Close( )
                >>>
                >>> System.IO.File. Delete(myExport File)
                >>> End Sub
                >>>
                >>> Private Function CreateParameter (ByVal ParameterName As String) As
                >>> ParameterField( )
                >>> Dim paramField As ParameterField
                >>>
                >>> paramField = New ParameterField
                >>> paramField.Para meterFieldName = ParameterName
                >>>
                >>> 'Return paramField
                >>>
                >>> End Function
                >>>
                >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                >>> As ParameterDiscre teValue()
                >>>
                >>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                >>> paramDiscreteVa lue = New ParameterDiscre teValue
                >>> paramDiscreteVa lue = Value
                >>>
                >>> 'Return paramDiscreteVa lue
                >>>
                >>> End Function
                >>>
                >>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                >>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                >>> Dim paramRangeValue As ParameterRangeV alue
                >>>
                >>> paramRangeValue = New ParameterRangeV alue
                >>>
                >>> paramRangeValue .StartValue = StartRange
                >>> paramRangeValue .EndValue = EndRange
                >>>
                >>> Return paramRangeValue
                >>> End Function
                >>>
                >>>
                >>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles cmdEerste.Click
                >>> crViewer.ShowFi rstPage()
                >>> End Sub
                >>>
                >>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e
                >>> As System.EventArg s) Handles cmdLaatste.Clic k
                >>> crViewer.ShowLa stPage()
                >>> End Sub
                >>>
                >>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles cmdTerug.Click
                >>> crViewer.ShowPr eviousPage()
                >>> End Sub
                >>>
                >>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                >>> System.EventArg s) Handles cmdVerder.Click
                >>> crViewer.ShowNe xtPage()
                >>> End Sub
                >>>
                >>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object,
                >>> ByVal e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                >>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                >>> End Sub
                >>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                >>> System.EventArg s) Handles MyBase.Unload
                >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                >>> String)
                >>>
                >>> System.IO.File. Delete(myExport File)
                >>> End Sub
                >>> End Class
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>
                >>>>
                >>>> "Alison Givens" <info@cross-it.nl> wrote in message
                >>>> news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...
                >>>>> When I use your solution I get blue lines under the text like this
                >>>>>
                >>>>> paramField = CreateParamater ("FiliaalKeuze" )
                >>>>> The text is:
                >>>>> Value of type '1 dimensional array of
                >>>>> CrystalDecision s.Shared.Parame terField' cannot be converted
                >>>>> to 'Crystal.Decisi ons.Shared.Para meterField'
                >>>>>
                >>>>> Return paramField
                >>>>> The text is:
                >>>>> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
                >>>>> converted
                >>>>> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
                >>>>>
                >>>>> Same for
                >>>>> paramField = CreateParamater ("Periode")
                >>>>> Return paramDiscreteVa lue
                >>>>>
                >>>>> Any idea what causes this?
                >>>>>
                >>>>> Alison
                >>>>>
                >>>>>
                >>>>> "AMDRIT" <amdrit@hotmail .com> wrote in message
                >>>>> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...
                >>>>>> Wow, you do all that for Crystal Reports? What is
                >>>>>> RapportAIRCOSto ringen?
                >>>>>>
                >>>>>>
                >>>>>> Here is all I do for CR
                >>>>>>
                >>>>>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
                >>>>>>
                >>>>>> x.Load(sReportP ath) 'Reports are not embedded resources
                >>>>>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
                >>>>>> Paramaters
                >>>>>> x.SetParameterV alue("Paramater 2", Paramaters(2))
                >>>>>> x.SetDataSource (mydata) 'Strongly Typed Datasets
                >>>>>>
                >>>>>> Me.CrystalRepor tViewer1.Report Source = x
                >>>>>> Me.CrystalRepor tViewer1.PrintR eport()
                >>>>>>
                >>>>>>
                >>>>>> 'Now to answer your question about your code, hmm
                >>>>>>
                >>>>>> Ok, first
                >>>>>>
                >>>>>> Never --> Dim x as new object
                >>>>>> 'This is silly, lazy and unprofessional. So if you are in
                >>>>>> high school, keep the course.
                >>>>>>
                >>>>>>
                >>>>>> Instead --> Dim x as object
                >>>>>> Set x = new object
                >>>>>> 'Reserve your space and contract
                >>>>>> 'Then make use of it.
                >>>>>>
                >>>>>> I think this is your problem
                >>>>>>
                >>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                >>>>>>
                >>>>>> Why are you setting the crView paramaters and the myReport
                >>>>>> paramaters?
                >>>>>> -->crViewer.Param eterFieldInfo = paramFields
                >>>>>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
                >>>>>>
                >>>>>> I think that myReport is the only think that needs to be set
                >>>>>>
                >>>>>>
                >>>>>> I had to spent time reading your code to understand what you were
                >>>>>> doing.
                >>>>>>
                >>>>>> Here is an attempt to clean it up.
                >>>>>>
                >>>>>> Private Sub TestIT()
                >>>>>>
                >>>>>> Dim myReport As RapportAIRCOSto ringen
                >>>>>> Dim paramFields As ParameterFields
                >>>>>> Dim paramField As ParameterField
                >>>>>>
                >>>>>> Dim BeginPeriode As String
                >>>>>> Dim EindPeriode As String
                >>>>>>
                >>>>>> 'Todo wrap everything in try
                >>>>>> paramFields = New ParameterFields
                >>>>>>
                >>>>>> Try
                >>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                >>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                >>>>>> Catch ex As Exception
                >>>>>> Dim exCustom As ApplicationExce ption
                >>>>>> exCustom = New ApplicationExce ption("Unable to parse Query
                >>>>>> Paramaters.", ex)
                >>>>>> Throw exCustom
                >>>>>> End Try
                >>>>>>
                >>>>>> 'Todo wrap in try
                >>>>>> paramField = CreateParamater ("FiliaalKeuze" )
                >>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                >>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                >>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                >>>>>> 'paramFields.Ad d(paramField) --> Not needed
                >>>>>>
                >>>>>> 'Todo wrap in try
                >>>>>> paramField = CreateParamater ("Periode")
                >>>>>>
                >>>>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                >>>>>> EindPeriode))
                >>>>>> myReport.SetPar ameterValue("Pe riode", paramField)
                >>>>>> 'paramFields.Ad d(paramField)--> Not needed
                >>>>>>
                >>>>>> 'Todo wrap in try, i don't think you need this
                >>>>>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
                >>>>>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
                >>>>>>
                >>>>>> 'Todo, determine if we need this step; I don't think you do
                >>>>>> 'crViewer.Param eterFieldInfo = paramFields
                >>>>>>
                >>>>>> crViewer.Report Source = myReport
                >>>>>>
                >>>>>> End Sub
                >>>>>>
                >>>>>> Private Function CreateParamater (ByVal ParamaterName As String) As
                >>>>>> ParameterField
                >>>>>> Dim paramField As ParameterField
                >>>>>>
                >>>>>> paramField = New ParameterField
                >>>>>> paramField.Para meterFieldName = ParamaterName
                >>>>>>
                >>>>>> Return paramField
                >>>>>>
                >>>>>> End Function
                >>>>>>
                >>>>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                >>>>>> As ParameterDiscre teValue
                >>>>>>
                >>>>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                >>>>>> paramDiscreteVa lue = New ParameterDiscre teValue
                >>>>>> paramDiscreteVa lue = Value
                >>>>>>
                >>>>>> Return paramDiscreteVa lue
                >>>>>>
                >>>>>> End Function
                >>>>>>
                >>>>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                >>>>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                >>>>>> Dim paramRangeValue As ParameterRangeV alue
                >>>>>>
                >>>>>> paramRangeValue = New ParameterRangeV alue
                >>>>>>
                >>>>>> paramRangeValue .StartValue = StartRange
                >>>>>> paramRangeValue .EndValue = EndRange
                >>>>>>
                >>>>>> Return paramRangeValue
                >>>>>> End Function
                >>>>>>
                >>>>>> "Alison Givens" <info@cross-it.nl> wrote in message
                >>>>>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
                >>>>>>> ...... that nobody knows the answer.
                >>>>>>> I can't imagine that I am the only one that uses parameters in CR.
                >>>>>>>
                >>>>>>> So, my question again:
                >>>>>>>
                >>>>>>> I have the following problem.
                >>>>>>> (VB.NET 2003 with CR)
                >>>>>>>
                >>>>>>> I have a report with a multiple-value discrete value and a
                >>>>>>> rangevalue.
                >>>>>>> The report shows fine in the viewer, but when I hit the export to
                >>>>>>> pdf
                >>>>>>> button, it only uses one of two discrete values.
                >>>>>>>
                >>>>>>> This is the code:
                >>>>>>> Dim BeginPeriode As String
                >>>>>>> Dim EindPeriode As String
                >>>>>>>
                >>>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                >>>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                >>>>>>>
                >>>>>>> Dim myReport As New RapportAIRCOSto ringen
                >>>>>>>
                >>>>>>> Dim paramFields As New ParameterFields
                >>>>>>> Dim paramField As New ParameterField
                >>>>>>> Dim discreteVal As New ParameterDiscre teValue
                >>>>>>> Dim rangeVal As New ParameterRangeV alue
                >>>>>>>
                >>>>>>> paramField.Para meterFieldName = "FiliaalKeu ze"
                >>>>>>> discreteVal.Val ue = "2044"
                >>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                >>>>>>>
                >>>>>>> discreteVal = New ParameterDiscre teValue
                >>>>>>> discreteVal.Val ue = "2344"
                >>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                >>>>>>>
                >>>>>>> paramFields.Add (paramField)
                >>>>>>>
                >>>>>>> paramField = New ParameterField
                >>>>>>>
                >>>>>>> paramField.Para meterFieldName = "Periode"
                >>>>>>>
                >>>>>>> rangeVal.StartV alue = BeginPeriode
                >>>>>>> rangeVal.EndVal ue = EindPeriode
                >>>>>>> paramField.Curr entValues.Add(r angeVal)
                >>>>>>>
                >>>>>>> paramFields.Add (paramField)
                >>>>>>>
                >>>>>>> crViewer.Parame terFieldInfo = paramFields
                >>>>>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
                >>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                >>>>>>> crViewer.Report Source = myReport
                >>>>>>>
                >>>>>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
                >>>>>>> It goes wrong with the discrete value. It only sees the second value
                >>>>>>> I
                >>>>>>> entered and not the first.
                >>>>>>> How can I get this going?
                >>>>>>>
                >>>>>>>
                >>>>>>> Kind regards,
                >>>>>>> Alison
                >>>>>>>
                >>>>>>>
                >>>>>>>
                >>>>>>>
                >>>>>>
                >>>>>>
                >>>>>
                >>>>>
                >>>>
                >>>>
                >>>
                >>>[/color]
                >>
                >>[/color]
                >
                >[/color]


                Comment

                • Alison Givens

                  #9
                  Re: How is it possible ...

                  Ok, to the next level.
                  I put the Add key in the web.config
                  It comes with an error as shown here.


                  Configuration Error
                  Description: An error occurred during the processing of a configuration file
                  required to service this request. Please review the specific error details
                  below and modify your configuration file appropriately.

                  Parser Error Message: Unrecognized element

                  Source Error:


                  Line 2: <configuratio n>
                  Line 3: <appSettings>
                  Line 4: <Add key="ReportExpo rtRoot" Value
                  ="\\192.168.2.1 06\syn2sql$\PDF _" />
                  Line 5: </appSettings>
                  Line 6: <system.web>


                  I did all the other things aswell, as you described.
                  I have a question though about the GetSession.
                  Is the code allright, as I placed here?

                  Private Function GetSessionValue (ByVal KeyName As String) As Object
                  Return Session.Item(Ke yName)
                  End Function

                  I really appreciate your help, but since I am a real greenhorn, I hope you
                  are not going to fast for me.

                  Alison






                  "AMDRIT" <amdrit@hotmail .com> wrote in message
                  news:OYjEf9vNGH A.532@TK2MSFTNG P15.phx.gbl...[color=blue]
                  > Good morning,
                  >
                  > I just realized you keep different hours than me. Please keep in mind
                  > that all the code that I have submitted to you is wholly untested and
                  > therefore the jist of what I was conveying should be taken into context.
                  > I attempt to answer your direct question before going off onto a tangent.
                  >
                  > 1. You need a function named GetSessionValue
                  > The signature would look like: GetSessionValue (KeyName as string) as
                  > object and all it would do is return Session.Item(Ke yName)
                  >
                  > 2. Correct the line
                  > myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                  > String.Format(" PDF_{0}.pdf", myExportFile))
                  > to
                  > myExportFile = System.IO.Path. Combine(GetExpo rtRoot(false),
                  > String.Format(" PDF_{0}.pdf", myExportFile))
                  > or
                  > myExportFile = System.IO.Path. Combine(GetExpo rtRoot(true),
                  > String.Format(" PDF_{0}.pdf", myExportFile))
                  >
                  > If you are to use the function GetExportRoot, then you must set up your
                  > global.asax to set a global variable to hold ReportExportRoo t in
                  > Application_OnS tart, and if you want each session to get a copy of that
                  > value in the global.asax Session_OnStart , have it read the Application
                  > variable.
                  >
                  > The goal here is to store environmental setting information out of
                  > compiled code. It's more work to set it up, but will not require you to
                  > compile the application everytime you want to make a change.
                  >
                  > ideal uses for the web config (DbConnection, ServerLocations , FileShares,
                  > WebService URLs)
                  >
                  > keep in mind though, each time you modify the webconfig, it spawns a new
                  > instance of your application. Existing users (those already connected)
                  > will not see your changes and will be orphaned from your intended
                  > solution. Changes to the web config, once in production, should be treated
                  > as a bug fix or enhancement that required replacement of binaries.
                  >
                  > Example
                  >
                  > In your web.config | appsettings section, create a key pair
                  >
                  > <Add key="ReportExpo rtRoot" Value = "\\192.168.2.10 6\syn2sql$\PDF_ " />
                  > for more information on appsettings see:
                  > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpgenref/html/gngrfappsetting selement.htm
                  >
                  > in your application's global.asax on Application_OnS tart
                  > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/vbcon/html/vbconPageApplic ationContext.ht m
                  > ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpguide/html/cpcontheglobala saxfile.htm
                  >
                  > sub application_ons tart()
                  > Dim ReportExportRoo t as string
                  > ReportExportRoo t =
                  > System.Configur ation.Configura tionSettings.Ap pSettings("Repo rtExportRoot")
                  > Application.Loc k
                  > Application("Re portExportRoot" ) = ReportExportRoo t
                  > Application.Unl ock
                  > end sub
                  >
                  > in you application's global.asax on Session_OnStart
                  > sub Session_Onstart ()
                  > Dim ReportExportRoo t as string
                  > Application.Loc k
                  > ReportExportRoo t = ctype(Applicati on("ReportExpor tRoot"),string)
                  > Application.Unl ock
                  > Session.item("R eportExportRoot ") = ReportExportRoo t
                  > end sub
                  >
                  > "Alison Givens" <info@cross-it.nl> wrote in message
                  > news:OTYvuJsNGH A.3164@TK2MSFTN GP11.phx.gbl...[color=green]
                  >>I used the code as you suggested, but again I get blue underlines.
                  >> First with every GetSessionValue ,it has a blue underline:
                  >> Name GetSessionValue is not declared
                  >>
                  >> and the other blue underline is GetExportRoot
                  >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                  >> String.Format(" PDF_{0}.pdf", myExportFile))
                  >> Says:Argument not specified for parameter 'FromApplicatio n' of
                  >> 'Private Function GetExportRoot(F romApplication As Boolean) As String'.
                  >>
                  >> I pasted the code again for your convenience.
                  >>
                  >>
                  >>
                  >> Private Enum FileNameFormats
                  >> SessionID = 0
                  >> GUIDDashes = 1
                  >> GUIDNoDashes = 2
                  >> End Enum
                  >>
                  >>
                  >> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles MyBase.Init
                  >> 'CODEGEN: This method call is required by the Web Form Designer
                  >> 'Do not modify it using the code editor.
                  >> InitializeCompo nent()
                  >> Dim myReport As RapportAIRCOSto ringen
                  >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                  >>
                  >> Try
                  >>
                  >> Try
                  >> PrepareReport(m yReport)
                  >> Catch ex As Exception
                  >> Dim exc As ApplicationExce ption
                  >> exc = New ApplicationExce ption("Unable to prepare
                  >> report.", ex)
                  >> Throw exc
                  >> End Try
                  >>
                  >> Try
                  >> 'exporteren to pdf
                  >> myExportOptions =
                  >> GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                  >> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                  >> myReport.Export ()
                  >>
                  >> Catch ex As Exception
                  >> Dim exc As ApplicationExce ption
                  >> exc = New ApplicationExce ption("Unable to export report.",
                  >> ex)
                  >> Throw exc
                  >> End Try
                  >>
                  >> crViewer.Report Source = myReport
                  >>
                  >> Session("export bestand") =
                  >> CType(myExportO ptions.Destinat ionOptions,
                  >> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                  >>
                  >> Catch err As Exception
                  >> Response.Write( "<BR>")
                  >> Response.Write( err.Message.ToS tring)
                  >> End Try
                  >>
                  >>
                  >>
                  >>
                  >> End Sub
                  >>
                  >> #End Region
                  >>
                  >> #Region "Page Implementation"
                  >>
                  >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles MyBase.Load
                  >> 'Put user code to initialize the page here
                  >> End Sub
                  >>
                  >> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                  >> System.EventArg s) Handles MyBase.Unload
                  >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                  >> String)
                  >>
                  >> System.IO.File. Delete(myExport File)
                  >> End Sub
                  >>
                  >> #End Region
                  >>
                  >> #Region "Report Setup"
                  >>
                  >> Private Sub PrepareReport(B yVal myReport As
                  >> CrystalDecision s.CrystalReport s.Engine.Report Document)
                  >>
                  >> Dim paramFields As ParameterFields
                  >> Dim paramField As ParameterField
                  >>
                  >> Const SessionExecptio n As String = "Unable to read session
                  >> objects."
                  >>
                  >> Try
                  >>
                  >> paramFields = New ParameterFields
                  >> Try
                  >> paramField = CreateParameter ("FiliaalKeuze" )
                  >>
                  >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                  >>
                  >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                  >>
                  >> Catch ex As Exception
                  >> Dim exc As System.Applicat ionException
                  >> exc = New System.Applicat ionException(Se ssionExecption,
                  >> ex)
                  >> Throw exc
                  >> End Try
                  >>
                  >> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                  >>
                  >> Try
                  >> 'Todo wrap in try
                  >> paramField = CreateParameter ("Periode")
                  >>
                  >> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                  >> GetSessionValue ("EindPeriode") ))
                  >> Catch ex As Exception
                  >> Dim exc As System.Applicat ionException
                  >> exc = New System.Applicat ionException(Se ssionExecption,
                  >> ex)
                  >> Throw exc
                  >> End Try
                  >>
                  >> myReport.SetPar ameterValue("Pe riode", paramField)
                  >>
                  >> Catch ex As Exception
                  >>
                  >> Dim exc As System.Applicat ionException
                  >> exc = New System.Applicat ionException("U nable to set
                  >> paramatervalue. ", ex)
                  >> Throw exc
                  >>
                  >> End Try
                  >>
                  >>
                  >> End Sub
                  >>
                  >> Private Function CreateParameter (ByVal ParameterName As String) As
                  >> ParameterField
                  >> Dim paramField As ParameterField
                  >>
                  >> paramField = New ParameterField
                  >> paramField.Para meterFieldName = ParameterName
                  >>
                  >> Return paramField
                  >>
                  >> End Function
                  >>
                  >> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                  >> As ParameterDiscre teValue
                  >>
                  >> Dim paramDiscreteVa lue As ParameterDiscre teValue
                  >> paramDiscreteVa lue = New ParameterDiscre teValue
                  >> paramDiscreteVa lue = Value
                  >>
                  >> Return paramDiscreteVa lue
                  >>
                  >> End Function
                  >>
                  >> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                  >> ByVal EndRange As Object) As ParameterRangeV alue
                  >> Dim paramRangeValue As ParameterRangeV alue
                  >>
                  >> paramRangeValue = New ParameterRangeV alue
                  >>
                  >> paramRangeValue .StartValue = StartRange
                  >> paramRangeValue .EndValue = EndRange
                  >>
                  >> Return paramRangeValue
                  >> End Function
                  >>
                  >> #End Region
                  >>
                  >> #Region "Report Export"
                  >>
                  >> Private Function GetExportOption s(ByVal UniqueFormat As
                  >> FileNameFormats , ByVal ExportOptions As
                  >> CrystalDecision s.Shared.Export Options) As
                  >> CrystalDecision s.Shared.Export Options
                  >>
                  >> Dim myExportFile As String
                  >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                  >> Dim myDiskFileDesti nationOptions As
                  >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >>
                  >> Try
                  >>
                  >> Select Case UniqueFormat
                  >> Case FileNameFormats .SessionID
                  >> myExportFile = Session.Session ID.ToString
                  >> Case FileNameFormats .GUIDDashes
                  >> myExportFile = System.Guid.New Guid.ToString(" D")
                  >> Case FileNameFormats .GUIDNoDashes
                  >> myExportFile = System.Guid.New Guid.ToString(" N")
                  >> End Select
                  >>
                  >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                  >> String.Format(" PDF_{0}.pdf", myExportFile))
                  >>
                  >> myDiskFileDesti nationOptions = New
                  >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                  >>
                  >> myExportOptions = ExportOptions
                  >>
                  >> With myExportOptions
                  >> .DestinationOpt ions = myDiskFileDesti nationOptions
                  >> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                  >> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                  >> End With
                  >>
                  >> Catch ex As Exception
                  >>
                  >> Dim exc As System.Applicat ionException
                  >> exc = New System.Applicat ionException("U nable to prepare
                  >> export options.", ex)
                  >> Throw exc
                  >>
                  >> End Try
                  >>
                  >> Return myExportOptions
                  >>
                  >> End Function
                  >>
                  >> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                  >> String
                  >>
                  >> Dim strExportRoot As String
                  >>
                  >> If FromApplication Then
                  >> Try
                  >> Application.Loc k()
                  >> strExportRoot = Application("Re portExportRoot" )
                  >> Catch ex As Exception
                  >> Dim exc As ApplicationExce ption
                  >> exc = New ApplicationExce ption("Unable to lock Web
                  >> Application for read.", ex)
                  >> Throw exc
                  >> Finally
                  >> Application.UnL ock()
                  >> End Try
                  >> Else
                  >> strExportRoot = Session("Report ExportRoot")
                  >> End If
                  >>
                  >> Return strExportRoot
                  >>
                  >> End Function
                  >>
                  >> #End Region
                  >>
                  >> #Region "Navigation Implementation"
                  >>
                  >> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles cmdPrint.Click
                  >>
                  >> Response.ClearC ontent()
                  >> Response.ClearH eaders()
                  >> Response.Conten tType = "applicatio n/pdf"
                  >>
                  >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                  >> String)
                  >>
                  >> Response.WriteF ile(myExportFil e)
                  >> Response.Flush( )
                  >> Response.Close( )
                  >>
                  >> System.IO.File. Delete(myExport File)
                  >>
                  >> End Sub
                  >>
                  >> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles cmdEerste.Click
                  >> crViewer.ShowFi rstPage()
                  >> End Sub
                  >>
                  >> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles cmdLaatste.Clic k
                  >> crViewer.ShowLa stPage()
                  >> End Sub
                  >>
                  >> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles cmdTerug.Click
                  >> crViewer.ShowPr eviousPage()
                  >> End Sub
                  >>
                  >> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                  >> System.EventArg s) Handles cmdVerder.Click
                  >> crViewer.ShowNe xtPage()
                  >> End Sub
                  >>
                  >> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
                  >> As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                  >> crViewer.Zoom(d rpZoom.Selected Item.Value)
                  >> End Sub
                  >>
                  >> #End Region
                  >>
                  >>
                  >> End Class
                  >>
                  >>
                  >>
                  >>
                  >> "AMDRIT" <amdrit@hotmail .com> wrote in message
                  >> news:OpMDndkNGH A.2064@TK2MSFTN GP09.phx.gbl...[color=darkred]
                  >>> Ok, first the isue you were having with the "Blue lines" is:
                  >>>
                  >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                  >>> ParameterDiscre teValue()
                  >>> --> Retun type is expecting an array of ParameterDiscre teValue
                  >>>
                  >>> it should be
                  >>>
                  >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                  >>> ParameterDiscre teValue
                  >>> --> Retun type is expecting an single ParameterDiscre teValue
                  >>>
                  >>> Second (Mostly because I was bored and also because I am still a
                  >>> novice), I have altered your code yet again.
                  >>>
                  >>>
                  >>> Private Enum FileNameFormats
                  >>> SessionID = 0
                  >>> GUIDDashes = 1
                  >>> GUIDNoDashes = 2
                  >>> End Enum
                  >>>
                  >>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles MyBase.Init
                  >>> 'CODEGEN: This method call is required by the Web Form Designer
                  >>> 'Do not modify it using the code editor.
                  >>> InitializeCompo nent()
                  >>>
                  >>> Dim myReport As RapportAIRCOSto ringen
                  >>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                  >>>
                  >>> Try
                  >>>
                  >>> Try
                  >>> PrepareReport(m yReport)
                  >>> Catch ex As Exception
                  >>> Dim exc As ApplicationExce ption
                  >>> exc = New ApplicationExce ption("Unable to prepare report.", ex)
                  >>> Throw exc
                  >>> End Try
                  >>>
                  >>> Try
                  >>> 'exporteren to pdf
                  >>> myExportOptions = GetExportOption s(FileNameForma ts.GUIDNoDashes ,
                  >>> CType(myReport,
                  >>> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                  >>> myReport.Export ()
                  >>>
                  >>> Catch ex As Exception
                  >>> Dim exc As ApplicationExce ption
                  >>> exc = New ApplicationExce ption("Unable to export report.", ex)
                  >>> Throw exc
                  >>> End Try
                  >>>
                  >>> crViewer.Report Source = myReport
                  >>>
                  >>> Session("export bestand") =
                  >>> CType(myExportO ptions.Destinat ionOptions,
                  >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                  >>>
                  >>> Catch err As Exception
                  >>> Response.Write( "<BR>")
                  >>> Response.Write( err.Message.ToS tring)
                  >>> End Try
                  >>>
                  >>> End Sub
                  >>>
                  >>> #Region "Page Implementation"
                  >>>
                  >>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles MyBase.Load
                  >>> 'Put user code to initialize the page here
                  >>> End Sub
                  >>>
                  >>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                  >>> System.EventArg s) Handles MyBase.Unload
                  >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                  >>> String)
                  >>>
                  >>> System.IO.File. Delete(myExport File)
                  >>> End Sub
                  >>>
                  >>> #End Region
                  >>>
                  >>> #Region "Report Setup"
                  >>>
                  >>> Private Sub PrepareReport(B yVal myReport As
                  >>> CrystalDecision s.CrystalReport s.Engine.Report Document)
                  >>>
                  >>> Dim paramFields As ParameterFields
                  >>> Dim paramField As ParameterField
                  >>>
                  >>> Const SessionExecptio n As String = "Unable to read session objects."
                  >>>
                  >>> Try
                  >>>
                  >>> paramFields = New ParameterFields
                  >>> Try
                  >>> paramField = CreateParameter ("FiliaalKeuze" )
                  >>>
                  >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                  >>>
                  >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                  >>> Catch ex As Exception
                  >>> Dim exc As System.Applicat ionException
                  >>> exc = New System.Applicat ionException(Se ssionExecption, ex)
                  >>> Throw exc
                  >>> End Try
                  >>>
                  >>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                  >>>
                  >>> Try
                  >>> 'Todo wrap in try
                  >>> paramField = CreateParameter ("Periode")
                  >>>
                  >>> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                  >>> GetSessionValue ("EindPeriode") ))
                  >>> Catch ex As Exception
                  >>> Dim exc As System.Applicat ionException
                  >>> exc = New System.Applicat ionException(Se ssionExecption, ex)
                  >>> Throw exc
                  >>> End Try
                  >>>
                  >>> myReport.SetPar ameterValue("Pe riode", paramField)
                  >>>
                  >>> Catch ex As Exception
                  >>>
                  >>> Dim exc As System.Applicat ionException
                  >>> exc = New System.Applicat ionException("U nable to set paramater
                  >>> value.", ex)
                  >>> Throw exc
                  >>>
                  >>> End Try
                  >>>
                  >>>
                  >>> End Sub
                  >>>
                  >>> Private Function CreateParameter (ByVal ParameterName As String) As
                  >>> ParameterField
                  >>> Dim paramField As ParameterField
                  >>>
                  >>> paramField = New ParameterField
                  >>> paramField.Para meterFieldName = ParameterName
                  >>>
                  >>> Return paramField
                  >>>
                  >>> End Function
                  >>>
                  >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                  >>> ParameterDiscre teValue()
                  >>>
                  >>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                  >>> paramDiscreteVa lue = New ParameterDiscre teValue
                  >>> paramDiscreteVa lue = Value
                  >>>
                  >>> 'Return paramDiscreteVa lue
                  >>>
                  >>> End Function
                  >>>
                  >>> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                  >>> ByVal EndRange As Object) As ParameterRangeV alue
                  >>> Dim paramRangeValue As ParameterRangeV alue
                  >>>
                  >>> paramRangeValue = New ParameterRangeV alue
                  >>>
                  >>> paramRangeValue .StartValue = StartRange
                  >>> paramRangeValue .EndValue = EndRange
                  >>>
                  >>> Return paramRangeValue
                  >>> End Function
                  >>>
                  >>> #End Region
                  >>>
                  >>> #Region "Report Export"
                  >>>
                  >>> Private Function GetExportOption s(ByVal UniqueFormat As
                  >>> FileNameFormats , ByVal ExportOptions As
                  >>> CrystalDecision s.Shared.Export Options) As
                  >>> CrystalDecision s.Shared.Export Options
                  >>>
                  >>> Dim myExportFile As String
                  >>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                  >>> Dim myDiskFileDesti nationOptions As
                  >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >>>
                  >>> Try
                  >>>
                  >>> Select Case UniqueFormat
                  >>> Case FileNameFormats .SessionID
                  >>> myExportFile = Session.Session ID.ToString
                  >>> Case FileNameFormats .GUIDDashes
                  >>> myExportFile = System.Guid.New Guid.ToString(" D")
                  >>> Case FileNameFormats .GUIDNoDashes
                  >>> myExportFile = System.Guid.New Guid.ToString(" N")
                  >>> End Select
                  >>>
                  >>> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                  >>> String.Format(" PDF_{0}.pdf", myExportFile))
                  >>>
                  >>> myDiskFileDesti nationOptions = New
                  >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                  >>>
                  >>> myExportOptions = ExportOptions
                  >>>
                  >>> With myExportOptions
                  >>> .DestinationOpt ions = myDiskFileDesti nationOptions
                  >>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                  >>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                  >>> End With
                  >>>
                  >>> Catch ex As Exception
                  >>>
                  >>> Dim exc As System.Applicat ionException
                  >>> exc = New System.Applicat ionException("U nable to prepare export
                  >>> options.", ex)
                  >>> Throw exc
                  >>>
                  >>> End Try
                  >>>
                  >>> Return myExportOptions
                  >>>
                  >>> End Function
                  >>>
                  >>> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                  >>> String
                  >>>
                  >>> Dim strExportRoot As String
                  >>>
                  >>> If FromApplication Then
                  >>> Try
                  >>> Application.loc k()
                  >>> strExportRoot = Application("Re portExportRoot" )
                  >>> Catch ex As Exception
                  >>> Dim exc As ApplicationExce ption
                  >>> exc = New ApplicationExce ption("Unable to lock Web Application
                  >>> for read.", ex)
                  >>> Throw exc
                  >>> Finally
                  >>> Application.unl ock()
                  >>> End Try
                  >>> Else
                  >>> strExportRoot = Session("Report ExportRoot")
                  >>> End If
                  >>>
                  >>> Return strExportRoot
                  >>>
                  >>> End Function
                  >>>
                  >>> #End Region
                  >>>
                  >>> #Region "Navigation Implementation"
                  >>>
                  >>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles cmdPrint.Click
                  >>>
                  >>> Response.ClearC ontent()
                  >>> Response.ClearH eaders()
                  >>> Response.Conten tType = "applicatio n/pdf"
                  >>>
                  >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                  >>> String)
                  >>>
                  >>> Response.WriteF ile(myExportFil e)
                  >>> Response.Flush( )
                  >>> Response.Close( )
                  >>>
                  >>> System.IO.File. Delete(myExport File)
                  >>>
                  >>> End Sub
                  >>>
                  >>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles cmdEerste.Click
                  >>> crViewer.ShowFi rstPage()
                  >>> End Sub
                  >>>
                  >>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles cmdLaatste.Clic k
                  >>> crViewer.ShowLa stPage()
                  >>> End Sub
                  >>>
                  >>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles cmdTerug.Click
                  >>> crViewer.ShowPr eviousPage()
                  >>> End Sub
                  >>>
                  >>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                  >>> System.EventArg s) Handles cmdVerder.Click
                  >>> crViewer.ShowNe xtPage()
                  >>> End Sub
                  >>>
                  >>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
                  >>> e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                  >>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                  >>> End Sub
                  >>>
                  >>> #End Region
                  >>>
                  >>>
                  >>> "Alison Givens" <info@cross-it.nl> wrote in message
                  >>> news:%23RW%23bs jNGHA.2124@TK2M SFTNGP14.phx.gb l...
                  >>>>> Perhaps you could share your resulting code for comparison? Did you
                  >>>>> see that I suggested the error in your code was
                  >>>>>
                  >>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only call
                  >>>>> this statement once (Effectively 2344) but you wanted two values.
                  >>>>
                  >>>> To get the thing going, it would be enough for me at first to know how
                  >>>> to call the statement twice, so the other value is forwarded too.
                  >>>> (btw, these two values will be SessionObjects two, but I did it
                  >>>> hardcoded for testing)
                  >>>> Best would be ofcourse that I learn to do it 'clean' of course. I am a
                  >>>> real newbee at this.
                  >>>>
                  >>>> Here is the rest of my code:
                  >>>>
                  >>>> Imports CrystalDecision s.CrystalReport s.Engine
                  >>>> Imports CrystalDecision s.CrystalReport s.Engine.Report Document
                  >>>> Imports CrystalDecision s.Shared
                  >>>> Imports System.IO
                  >>>>
                  >>>>
                  >>>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                  >>>> System.EventArg s) Handles MyBase.Init
                  >>>> 'CODEGEN: This method call is required by the Web Form Designer
                  >>>> 'Do not modify it using the code editor.
                  >>>> InitializeCompo nent()
                  >>>>
                  >>>>
                  >>>>
                  >>>> Dim myReport As RapportAIRCOSto ringen
                  >>>> Dim paramFields As ParameterFields
                  >>>> Dim paramField As ParameterField
                  >>>>
                  >>>> Dim BeginPeriode As String
                  >>>> Dim EindPeriode As String
                  >>>>
                  >>>> 'Todo wrap everything in try
                  >>>> paramFields = New ParameterFields
                  >>>>
                  >>>> Try
                  >>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                  >>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                  >>>> Catch ex As Exception
                  >>>> Dim exCustom As ApplicationExce ption
                  >>>> exCustom = New ApplicationExce ption("Unable to parse Query
                  >>>> Paramaters.", ex)
                  >>>> Throw exCustom
                  >>>> End Try
                  >>>>
                  >>>> 'Todo wrap in try
                  >>>> paramField = CreateParameter ("FiliaalKeuze" )
                  >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                  >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                  >>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                  >>>>
                  >>>>
                  >>>> 'Todo wrap in try
                  >>>> paramField = CreateParameter ("Periode")
                  >>>>
                  >>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                  >>>> EindPeriode))
                  >>>> myReport.SetPar ameterValue("Pe riode", paramField)
                  >>>>
                  >>>>
                  >>>> crViewer.Report Source = myReport
                  >>>>
                  >>>>
                  >>>> 'exporteren to pdf
                  >>>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                  >>>> Dim myDiskFileDesti nationOptions As
                  >>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >>>> Dim myExportFile As String
                  >>>>
                  >>>>
                  >>>>
                  >>>> myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
                  >>>> Session.Session ID.ToString & ".pdf"
                  >>>> myDiskFileDesti nationOptions = New
                  >>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                  >>>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                  >>>> myExportOptions = myReport.Export Options
                  >>>> With myExportOptions
                  >>>> .DestinationOpt ions = myDiskFileDesti nationOptions
                  >>>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                  >>>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                  >>>> End With
                  >>>>
                  >>>> Try
                  >>>> myReport.Export ()
                  >>>> Catch err As Exception
                  >>>> Response.Write( "<BR>")
                  >>>> Response.Write( err.Message.ToS tring)
                  >>>> End Try
                  >>>>
                  >>>> Session("export bestand") = myExportFile
                  >>>> End Sub
                  >>>>
                  >>>> #End Region
                  >>>>
                  >>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                  >>>> System.EventArg s) Handles MyBase.Load
                  >>>> 'Put user code to initialize the page here
                  >>>> End Sub
                  >>>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                  >>>> System.EventArg s) Handles cmdPrint.Click
                  >>>> Response.ClearC ontent()
                  >>>> Response.ClearH eaders()
                  >>>> Response.Conten tType = "applicatio n/pdf"
                  >>>> Dim myExportFile As String =
                  >>>> CType(Session.I tem("exportbest and"), String)
                  >>>>
                  >>>> Response.WriteF ile(myExportFil e)
                  >>>> Response.Flush( )
                  >>>> Response.Close( )
                  >>>>
                  >>>> System.IO.File. Delete(myExport File)
                  >>>> End Sub
                  >>>>
                  >>>> Private Function CreateParameter (ByVal ParameterName As String) As
                  >>>> ParameterField( )
                  >>>> Dim paramField As ParameterField
                  >>>>
                  >>>> paramField = New ParameterField
                  >>>> paramField.Para meterFieldName = ParameterName
                  >>>>
                  >>>> 'Return paramField
                  >>>>
                  >>>> End Function
                  >>>>
                  >>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                  >>>> As ParameterDiscre teValue()
                  >>>>
                  >>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                  >>>> paramDiscreteVa lue = New ParameterDiscre teValue
                  >>>> paramDiscreteVa lue = Value
                  >>>>
                  >>>> 'Return paramDiscreteVa lue
                  >>>>
                  >>>> End Function
                  >>>>
                  >>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                  >>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                  >>>> Dim paramRangeValue As ParameterRangeV alue
                  >>>>
                  >>>> paramRangeValue = New ParameterRangeV alue
                  >>>>
                  >>>> paramRangeValue .StartValue = StartRange
                  >>>> paramRangeValue .EndValue = EndRange
                  >>>>
                  >>>> Return paramRangeValue
                  >>>> End Function
                  >>>>
                  >>>>
                  >>>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e
                  >>>> As System.EventArg s) Handles cmdEerste.Click
                  >>>> crViewer.ShowFi rstPage()
                  >>>> End Sub
                  >>>>
                  >>>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e
                  >>>> As System.EventArg s) Handles cmdLaatste.Clic k
                  >>>> crViewer.ShowLa stPage()
                  >>>> End Sub
                  >>>>
                  >>>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                  >>>> System.EventArg s) Handles cmdTerug.Click
                  >>>> crViewer.ShowPr eviousPage()
                  >>>> End Sub
                  >>>>
                  >>>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e
                  >>>> As System.EventArg s) Handles cmdVerder.Click
                  >>>> crViewer.ShowNe xtPage()
                  >>>> End Sub
                  >>>>
                  >>>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object,
                  >>>> ByVal e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                  >>>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                  >>>> End Sub
                  >>>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                  >>>> System.EventArg s) Handles MyBase.Unload
                  >>>> Dim myExportFile As String =
                  >>>> CType(Session.I tem("exportbest and"), String)
                  >>>>
                  >>>> System.IO.File. Delete(myExport File)
                  >>>> End Sub
                  >>>> End Class
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>>
                  >>>>>
                  >>>>> "Alison Givens" <info@cross-it.nl> wrote in message
                  >>>>> news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...
                  >>>>>> When I use your solution I get blue lines under the text like this
                  >>>>>>
                  >>>>>> paramField = CreateParamater ("FiliaalKeuze" )
                  >>>>>> The text is:
                  >>>>>> Value of type '1 dimensional array of
                  >>>>>> CrystalDecision s.Shared.Parame terField' cannot be converted
                  >>>>>> to 'Crystal.Decisi ons.Shared.Para meterField'
                  >>>>>>
                  >>>>>> Return paramField
                  >>>>>> The text is:
                  >>>>>> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
                  >>>>>> converted
                  >>>>>> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
                  >>>>>>
                  >>>>>> Same for
                  >>>>>> paramField = CreateParamater ("Periode")
                  >>>>>> Return paramDiscreteVa lue
                  >>>>>>
                  >>>>>> Any idea what causes this?
                  >>>>>>
                  >>>>>> Alison
                  >>>>>>
                  >>>>>>
                  >>>>>> "AMDRIT" <amdrit@hotmail .com> wrote in message
                  >>>>>> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...
                  >>>>>>> Wow, you do all that for Crystal Reports? What is
                  >>>>>>> RapportAIRCOSto ringen?
                  >>>>>>>
                  >>>>>>>
                  >>>>>>> Here is all I do for CR
                  >>>>>>>
                  >>>>>>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
                  >>>>>>>
                  >>>>>>> x.Load(sReportP ath) 'Reports are not embedded resources
                  >>>>>>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
                  >>>>>>> Paramaters
                  >>>>>>> x.SetParameterV alue("Paramater 2", Paramaters(2))
                  >>>>>>> x.SetDataSource (mydata) 'Strongly Typed Datasets
                  >>>>>>>
                  >>>>>>> Me.CrystalRepor tViewer1.Report Source = x
                  >>>>>>> Me.CrystalRepor tViewer1.PrintR eport()
                  >>>>>>>
                  >>>>>>>
                  >>>>>>> 'Now to answer your question about your code, hmm
                  >>>>>>>
                  >>>>>>> Ok, first
                  >>>>>>>
                  >>>>>>> Never --> Dim x as new object
                  >>>>>>> 'This is silly, lazy and unprofessional. So if you are in
                  >>>>>>> high school, keep the course.
                  >>>>>>>
                  >>>>>>>
                  >>>>>>> Instead --> Dim x as object
                  >>>>>>> Set x = new object
                  >>>>>>> 'Reserve your space and contract
                  >>>>>>> 'Then make use of it.
                  >>>>>>>
                  >>>>>>> I think this is your problem
                  >>>>>>>
                  >>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                  >>>>>>>
                  >>>>>>> Why are you setting the crView paramaters and the myReport
                  >>>>>>> paramaters?
                  >>>>>>> -->crViewer.Param eterFieldInfo = paramFields
                  >>>>>>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
                  >>>>>>>
                  >>>>>>> I think that myReport is the only think that needs to be set
                  >>>>>>>
                  >>>>>>>
                  >>>>>>> I had to spent time reading your code to understand what you were
                  >>>>>>> doing.
                  >>>>>>>
                  >>>>>>> Here is an attempt to clean it up.
                  >>>>>>>
                  >>>>>>> Private Sub TestIT()
                  >>>>>>>
                  >>>>>>> Dim myReport As RapportAIRCOSto ringen
                  >>>>>>> Dim paramFields As ParameterFields
                  >>>>>>> Dim paramField As ParameterField
                  >>>>>>>
                  >>>>>>> Dim BeginPeriode As String
                  >>>>>>> Dim EindPeriode As String
                  >>>>>>>
                  >>>>>>> 'Todo wrap everything in try
                  >>>>>>> paramFields = New ParameterFields
                  >>>>>>>
                  >>>>>>> Try
                  >>>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                  >>>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                  >>>>>>> Catch ex As Exception
                  >>>>>>> Dim exCustom As ApplicationExce ption
                  >>>>>>> exCustom = New ApplicationExce ption("Unable to parse Query
                  >>>>>>> Paramaters.", ex)
                  >>>>>>> Throw exCustom
                  >>>>>>> End Try
                  >>>>>>>
                  >>>>>>> 'Todo wrap in try
                  >>>>>>> paramField = CreateParamater ("FiliaalKeuze" )
                  >>>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                  >>>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                  >>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                  >>>>>>> 'paramFields.Ad d(paramField) --> Not needed
                  >>>>>>>
                  >>>>>>> 'Todo wrap in try
                  >>>>>>> paramField = CreateParamater ("Periode")
                  >>>>>>>
                  >>>>>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                  >>>>>>> EindPeriode))
                  >>>>>>> myReport.SetPar ameterValue("Pe riode", paramField)
                  >>>>>>> 'paramFields.Ad d(paramField)--> Not needed
                  >>>>>>>
                  >>>>>>> 'Todo wrap in try, i don't think you need this
                  >>>>>>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
                  >>>>>>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
                  >>>>>>>
                  >>>>>>> 'Todo, determine if we need this step; I don't think you do
                  >>>>>>> 'crViewer.Param eterFieldInfo = paramFields
                  >>>>>>>
                  >>>>>>> crViewer.Report Source = myReport
                  >>>>>>>
                  >>>>>>> End Sub
                  >>>>>>>
                  >>>>>>> Private Function CreateParamater (ByVal ParamaterName As String) As
                  >>>>>>> ParameterField
                  >>>>>>> Dim paramField As ParameterField
                  >>>>>>>
                  >>>>>>> paramField = New ParameterField
                  >>>>>>> paramField.Para meterFieldName = ParamaterName
                  >>>>>>>
                  >>>>>>> Return paramField
                  >>>>>>>
                  >>>>>>> End Function
                  >>>>>>>
                  >>>>>>> Private Function CreateParameter DiscreteValue(B yVal Value As
                  >>>>>>> Object) As ParameterDiscre teValue
                  >>>>>>>
                  >>>>>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                  >>>>>>> paramDiscreteVa lue = New ParameterDiscre teValue
                  >>>>>>> paramDiscreteVa lue = Value
                  >>>>>>>
                  >>>>>>> Return paramDiscreteVa lue
                  >>>>>>>
                  >>>>>>> End Function
                  >>>>>>>
                  >>>>>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                  >>>>>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                  >>>>>>> Dim paramRangeValue As ParameterRangeV alue
                  >>>>>>>
                  >>>>>>> paramRangeValue = New ParameterRangeV alue
                  >>>>>>>
                  >>>>>>> paramRangeValue .StartValue = StartRange
                  >>>>>>> paramRangeValue .EndValue = EndRange
                  >>>>>>>
                  >>>>>>> Return paramRangeValue
                  >>>>>>> End Function
                  >>>>>>>
                  >>>>>>> "Alison Givens" <info@cross-it.nl> wrote in message
                  >>>>>>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
                  >>>>>>>> ...... that nobody knows the answer.
                  >>>>>>>> I can't imagine that I am the only one that uses parameters in CR.
                  >>>>>>>>
                  >>>>>>>> So, my question again:
                  >>>>>>>>
                  >>>>>>>> I have the following problem.
                  >>>>>>>> (VB.NET 2003 with CR)
                  >>>>>>>>
                  >>>>>>>> I have a report with a multiple-value discrete value and a
                  >>>>>>>> rangevalue.
                  >>>>>>>> The report shows fine in the viewer, but when I hit the export to
                  >>>>>>>> pdf
                  >>>>>>>> button, it only uses one of two discrete values.
                  >>>>>>>>
                  >>>>>>>> This is the code:
                  >>>>>>>> Dim BeginPeriode As String
                  >>>>>>>> Dim EindPeriode As String
                  >>>>>>>>
                  >>>>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                  >>>>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                  >>>>>>>>
                  >>>>>>>> Dim myReport As New RapportAIRCOSto ringen
                  >>>>>>>>
                  >>>>>>>> Dim paramFields As New ParameterFields
                  >>>>>>>> Dim paramField As New ParameterField
                  >>>>>>>> Dim discreteVal As New ParameterDiscre teValue
                  >>>>>>>> Dim rangeVal As New ParameterRangeV alue
                  >>>>>>>>
                  >>>>>>>> paramField.Para meterFieldName = "FiliaalKeu ze"
                  >>>>>>>> discreteVal.Val ue = "2044"
                  >>>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                  >>>>>>>>
                  >>>>>>>> discreteVal = New ParameterDiscre teValue
                  >>>>>>>> discreteVal.Val ue = "2344"
                  >>>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                  >>>>>>>>
                  >>>>>>>> paramFields.Add (paramField)
                  >>>>>>>>
                  >>>>>>>> paramField = New ParameterField
                  >>>>>>>>
                  >>>>>>>> paramField.Para meterFieldName = "Periode"
                  >>>>>>>>
                  >>>>>>>> rangeVal.StartV alue = BeginPeriode
                  >>>>>>>> rangeVal.EndVal ue = EindPeriode
                  >>>>>>>> paramField.Curr entValues.Add(r angeVal)
                  >>>>>>>>
                  >>>>>>>> paramFields.Add (paramField)
                  >>>>>>>>
                  >>>>>>>> crViewer.Parame terFieldInfo = paramFields
                  >>>>>>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
                  >>>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                  >>>>>>>> crViewer.Report Source = myReport
                  >>>>>>>>
                  >>>>>>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
                  >>>>>>>> It goes wrong with the discrete value. It only sees the second
                  >>>>>>>> value I
                  >>>>>>>> entered and not the first.
                  >>>>>>>> How can I get this going?
                  >>>>>>>>
                  >>>>>>>>
                  >>>>>>>> Kind regards,
                  >>>>>>>> Alison
                  >>>>>>>>
                  >>>>>>>>
                  >>>>>>>>
                  >>>>>>>>
                  >>>>>>>
                  >>>>>>>
                  >>>>>>
                  >>>>>>
                  >>>>>
                  >>>>>
                  >>>>
                  >>>>
                  >>>
                  >>>[/color]
                  >>
                  >>[/color]
                  >
                  >[/color]


                  Comment

                  • AMDRIT

                    #10
                    Re: How is it possible ...

                    Perhaps web.config is case sensitive.

                    <configuratio n>
                    <appSettings>
                    <add key="ReportExpo rtRoot" value="\\192.16 8.2.106\syn2sql $\PDF_" />
                    </appSettings>
                    </configuration>

                    works for me, however notice add, key, and value are lower case. try that.

                    Your function is fine, perhaps you would like to spice it up a bit. (it is
                    really up to you and the amount of error handeling you would like.)
                    [color=blue]
                    > Private Function GetSessionValue (ByVal KeyName As String) As Object[/color]
                    try[color=blue]
                    > Return Session.Item(Ke yName)[/color]
                    catch ex as exception
                    dim exc as applicationexce ption
                    exc = new applicationexce ption(string.fo rmat("Unable to read value from
                    session:{0}",Ke yName),ex)
                    throw exc
                    end try[color=blue]
                    > End Function[/color]

                    there is a great series of webcasts on the MS Events site. The series was
                    presented by Joe Hummel, you should have a look at them. Here is a link to
                    get you started, the best part is that they are free.

                    http://www.microsoft.com/events/Even...taSvcParams%5e

                    or just go to msdn.microsoft. com/events, choose webcasts | Ondemand
                    webcasts. and then search for topics of interest. Many are .Net 1.1
                    related but the concepts carry forward to .Net 2.0.

                    If you have more questions, just drop a post here.

                    "Alison Givens" <info@cross-it.nl> wrote in message
                    news:uV136d4NGH A.516@TK2MSFTNG P15.phx.gbl...[color=blue]
                    > Ok, to the next level.
                    > I put the Add key in the web.config
                    > It comes with an error as shown here.
                    >
                    >
                    > Configuration Error
                    > Description: An error occurred during the processing of a configuration
                    > file required to service this request. Please review the specific error
                    > details below and modify your configuration file appropriately.
                    >
                    > Parser Error Message: Unrecognized element
                    >
                    > Source Error:
                    >
                    >
                    > Line 2: <configuratio n>
                    > Line 3: <appSettings>
                    > Line 4: <Add key="ReportExpo rtRoot" Value
                    > ="\\192.168.2.1 06\syn2sql$\PDF _" />
                    > Line 5: </appSettings>
                    > Line 6: <system.web>
                    >
                    >
                    > I did all the other things aswell, as you described.
                    > I have a question though about the GetSession.
                    > Is the code allright, as I placed here?
                    >
                    > Private Function GetSessionValue (ByVal KeyName As String) As Object
                    > Return Session.Item(Ke yName)
                    > End Function
                    >
                    > I really appreciate your help, but since I am a real greenhorn, I hope you
                    > are not going to fast for me.
                    >
                    > Alison
                    >
                    >
                    >
                    >
                    >
                    >
                    > "AMDRIT" <amdrit@hotmail .com> wrote in message
                    > news:OYjEf9vNGH A.532@TK2MSFTNG P15.phx.gbl...[color=green]
                    >> Good morning,
                    >>
                    >> I just realized you keep different hours than me. Please keep in mind
                    >> that all the code that I have submitted to you is wholly untested and
                    >> therefore the jist of what I was conveying should be taken into context.
                    >> I attempt to answer your direct question before going off onto a tangent.
                    >>
                    >> 1. You need a function named GetSessionValue
                    >> The signature would look like: GetSessionValue (KeyName as string) as
                    >> object and all it would do is return Session.Item(Ke yName)
                    >>
                    >> 2. Correct the line
                    >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                    >> String.Format(" PDF_{0}.pdf", myExportFile))
                    >> to
                    >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot(false),
                    >> String.Format(" PDF_{0}.pdf", myExportFile))
                    >> or
                    >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot(true),
                    >> String.Format(" PDF_{0}.pdf", myExportFile))
                    >>
                    >> If you are to use the function GetExportRoot, then you must set up your
                    >> global.asax to set a global variable to hold ReportExportRoo t in
                    >> Application_OnS tart, and if you want each session to get a copy of that
                    >> value in the global.asax Session_OnStart , have it read the Application
                    >> variable.
                    >>
                    >> The goal here is to store environmental setting information out of
                    >> compiled code. It's more work to set it up, but will not require you to
                    >> compile the application everytime you want to make a change.
                    >>
                    >> ideal uses for the web config (DbConnection, ServerLocations , FileShares,
                    >> WebService URLs)
                    >>
                    >> keep in mind though, each time you modify the webconfig, it spawns a new
                    >> instance of your application. Existing users (those already connected)
                    >> will not see your changes and will be orphaned from your intended
                    >> solution. Changes to the web config, once in production, should be
                    >> treated as a bug fix or enhancement that required replacement of
                    >> binaries.
                    >>
                    >> Example
                    >>
                    >> In your web.config | appsettings section, create a key pair
                    >>
                    >> <Add key="ReportExpo rtRoot" Value = "\\192.168.2.10 6\syn2sql$\PDF_ " />
                    >> for more information on appsettings see:
                    >> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpgenref/html/gngrfappsetting selement.htm
                    >>
                    >> in your application's global.asax on Application_OnS tart
                    >> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/vbcon/html/vbconPageApplic ationContext.ht m
                    >> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003 FEB.1033/cpguide/html/cpcontheglobala saxfile.htm
                    >>
                    >> sub application_ons tart()
                    >> Dim ReportExportRoo t as string
                    >> ReportExportRoo t =
                    >> System.Configur ation.Configura tionSettings.Ap pSettings("Repo rtExportRoot")
                    >> Application.Loc k
                    >> Application("Re portExportRoot" ) = ReportExportRoo t
                    >> Application.Unl ock
                    >> end sub
                    >>
                    >> in you application's global.asax on Session_OnStart
                    >> sub Session_Onstart ()
                    >> Dim ReportExportRoo t as string
                    >> Application.Loc k
                    >> ReportExportRoo t = ctype(Applicati on("ReportExpor tRoot"),string)
                    >> Application.Unl ock
                    >> Session.item("R eportExportRoot ") = ReportExportRoo t
                    >> end sub
                    >>
                    >> "Alison Givens" <info@cross-it.nl> wrote in message
                    >> news:OTYvuJsNGH A.3164@TK2MSFTN GP11.phx.gbl...[color=darkred]
                    >>>I used the code as you suggested, but again I get blue underlines.
                    >>> First with every GetSessionValue ,it has a blue underline:
                    >>> Name GetSessionValue is not declared
                    >>>
                    >>> and the other blue underline is GetExportRoot
                    >>> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                    >>> String.Format(" PDF_{0}.pdf", myExportFile))
                    >>> Says:Argument not specified for parameter 'FromApplicatio n' of
                    >>> 'Private Function GetExportRoot(F romApplication As Boolean) As String'.
                    >>>
                    >>> I pasted the code again for your convenience.
                    >>>
                    >>>
                    >>>
                    >>> Private Enum FileNameFormats
                    >>> SessionID = 0
                    >>> GUIDDashes = 1
                    >>> GUIDNoDashes = 2
                    >>> End Enum
                    >>>
                    >>>
                    >>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles MyBase.Init
                    >>> 'CODEGEN: This method call is required by the Web Form Designer
                    >>> 'Do not modify it using the code editor.
                    >>> InitializeCompo nent()
                    >>> Dim myReport As RapportAIRCOSto ringen
                    >>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                    >>>
                    >>> Try
                    >>>
                    >>> Try
                    >>> PrepareReport(m yReport)
                    >>> Catch ex As Exception
                    >>> Dim exc As ApplicationExce ption
                    >>> exc = New ApplicationExce ption("Unable to prepare
                    >>> report.", ex)
                    >>> Throw exc
                    >>> End Try
                    >>>
                    >>> Try
                    >>> 'exporteren to pdf
                    >>> myExportOptions =
                    >>> GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                    >>> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                    >>> myReport.Export ()
                    >>>
                    >>> Catch ex As Exception
                    >>> Dim exc As ApplicationExce ption
                    >>> exc = New ApplicationExce ption("Unable to export
                    >>> report.", ex)
                    >>> Throw exc
                    >>> End Try
                    >>>
                    >>> crViewer.Report Source = myReport
                    >>>
                    >>> Session("export bestand") =
                    >>> CType(myExportO ptions.Destinat ionOptions,
                    >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                    >>>
                    >>> Catch err As Exception
                    >>> Response.Write( "<BR>")
                    >>> Response.Write( err.Message.ToS tring)
                    >>> End Try
                    >>>
                    >>>
                    >>>
                    >>>
                    >>> End Sub
                    >>>
                    >>> #End Region
                    >>>
                    >>> #Region "Page Implementation"
                    >>>
                    >>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles MyBase.Load
                    >>> 'Put user code to initialize the page here
                    >>> End Sub
                    >>>
                    >>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                    >>> System.EventArg s) Handles MyBase.Unload
                    >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                    >>> String)
                    >>>
                    >>> System.IO.File. Delete(myExport File)
                    >>> End Sub
                    >>>
                    >>> #End Region
                    >>>
                    >>> #Region "Report Setup"
                    >>>
                    >>> Private Sub PrepareReport(B yVal myReport As
                    >>> CrystalDecision s.CrystalReport s.Engine.Report Document)
                    >>>
                    >>> Dim paramFields As ParameterFields
                    >>> Dim paramField As ParameterField
                    >>>
                    >>> Const SessionExecptio n As String = "Unable to read session
                    >>> objects."
                    >>>
                    >>> Try
                    >>>
                    >>> paramFields = New ParameterFields
                    >>> Try
                    >>> paramField = CreateParameter ("FiliaalKeuze" )
                    >>>
                    >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                    >>>
                    >>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                    >>>
                    >>> Catch ex As Exception
                    >>> Dim exc As System.Applicat ionException
                    >>> exc = New System.Applicat ionException(Se ssionExecption,
                    >>> ex)
                    >>> Throw exc
                    >>> End Try
                    >>>
                    >>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                    >>>
                    >>> Try
                    >>> 'Todo wrap in try
                    >>> paramField = CreateParameter ("Periode")
                    >>>
                    >>> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                    >>> GetSessionValue ("EindPeriode") ))
                    >>> Catch ex As Exception
                    >>> Dim exc As System.Applicat ionException
                    >>> exc = New System.Applicat ionException(Se ssionExecption,
                    >>> ex)
                    >>> Throw exc
                    >>> End Try
                    >>>
                    >>> myReport.SetPar ameterValue("Pe riode", paramField)
                    >>>
                    >>> Catch ex As Exception
                    >>>
                    >>> Dim exc As System.Applicat ionException
                    >>> exc = New System.Applicat ionException("U nable to set
                    >>> paramatervalue. ", ex)
                    >>> Throw exc
                    >>>
                    >>> End Try
                    >>>
                    >>>
                    >>> End Sub
                    >>>
                    >>> Private Function CreateParameter (ByVal ParameterName As String) As
                    >>> ParameterField
                    >>> Dim paramField As ParameterField
                    >>>
                    >>> paramField = New ParameterField
                    >>> paramField.Para meterFieldName = ParameterName
                    >>>
                    >>> Return paramField
                    >>>
                    >>> End Function
                    >>>
                    >>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                    >>> As ParameterDiscre teValue
                    >>>
                    >>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                    >>> paramDiscreteVa lue = New ParameterDiscre teValue
                    >>> paramDiscreteVa lue = Value
                    >>>
                    >>> Return paramDiscreteVa lue
                    >>>
                    >>> End Function
                    >>>
                    >>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                    >>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                    >>> Dim paramRangeValue As ParameterRangeV alue
                    >>>
                    >>> paramRangeValue = New ParameterRangeV alue
                    >>>
                    >>> paramRangeValue .StartValue = StartRange
                    >>> paramRangeValue .EndValue = EndRange
                    >>>
                    >>> Return paramRangeValue
                    >>> End Function
                    >>>
                    >>> #End Region
                    >>>
                    >>> #Region "Report Export"
                    >>>
                    >>> Private Function GetExportOption s(ByVal UniqueFormat As
                    >>> FileNameFormats , ByVal ExportOptions As
                    >>> CrystalDecision s.Shared.Export Options) As
                    >>> CrystalDecision s.Shared.Export Options
                    >>>
                    >>> Dim myExportFile As String
                    >>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                    >>> Dim myDiskFileDesti nationOptions As
                    >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>>
                    >>> Try
                    >>>
                    >>> Select Case UniqueFormat
                    >>> Case FileNameFormats .SessionID
                    >>> myExportFile = Session.Session ID.ToString
                    >>> Case FileNameFormats .GUIDDashes
                    >>> myExportFile = System.Guid.New Guid.ToString(" D")
                    >>> Case FileNameFormats .GUIDNoDashes
                    >>> myExportFile = System.Guid.New Guid.ToString(" N")
                    >>> End Select
                    >>>
                    >>> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                    >>> String.Format(" PDF_{0}.pdf", myExportFile))
                    >>>
                    >>> myDiskFileDesti nationOptions = New
                    >>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                    >>>
                    >>> myExportOptions = ExportOptions
                    >>>
                    >>> With myExportOptions
                    >>> .DestinationOpt ions = myDiskFileDesti nationOptions
                    >>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                    >>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                    >>> End With
                    >>>
                    >>> Catch ex As Exception
                    >>>
                    >>> Dim exc As System.Applicat ionException
                    >>> exc = New System.Applicat ionException("U nable to prepare
                    >>> export options.", ex)
                    >>> Throw exc
                    >>>
                    >>> End Try
                    >>>
                    >>> Return myExportOptions
                    >>>
                    >>> End Function
                    >>>
                    >>> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                    >>> String
                    >>>
                    >>> Dim strExportRoot As String
                    >>>
                    >>> If FromApplication Then
                    >>> Try
                    >>> Application.Loc k()
                    >>> strExportRoot = Application("Re portExportRoot" )
                    >>> Catch ex As Exception
                    >>> Dim exc As ApplicationExce ption
                    >>> exc = New ApplicationExce ption("Unable to lock Web
                    >>> Application for read.", ex)
                    >>> Throw exc
                    >>> Finally
                    >>> Application.UnL ock()
                    >>> End Try
                    >>> Else
                    >>> strExportRoot = Session("Report ExportRoot")
                    >>> End If
                    >>>
                    >>> Return strExportRoot
                    >>>
                    >>> End Function
                    >>>
                    >>> #End Region
                    >>>
                    >>> #Region "Navigation Implementation"
                    >>>
                    >>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles cmdPrint.Click
                    >>>
                    >>> Response.ClearC ontent()
                    >>> Response.ClearH eaders()
                    >>> Response.Conten tType = "applicatio n/pdf"
                    >>>
                    >>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                    >>> String)
                    >>>
                    >>> Response.WriteF ile(myExportFil e)
                    >>> Response.Flush( )
                    >>> Response.Close( )
                    >>>
                    >>> System.IO.File. Delete(myExport File)
                    >>>
                    >>> End Sub
                    >>>
                    >>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles cmdEerste.Click
                    >>> crViewer.ShowFi rstPage()
                    >>> End Sub
                    >>>
                    >>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e
                    >>> As System.EventArg s) Handles cmdLaatste.Clic k
                    >>> crViewer.ShowLa stPage()
                    >>> End Sub
                    >>>
                    >>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles cmdTerug.Click
                    >>> crViewer.ShowPr eviousPage()
                    >>> End Sub
                    >>>
                    >>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                    >>> System.EventArg s) Handles cmdVerder.Click
                    >>> crViewer.ShowNe xtPage()
                    >>> End Sub
                    >>>
                    >>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
                    >>> e
                    >>> As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                    >>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                    >>> End Sub
                    >>>
                    >>> #End Region
                    >>>
                    >>>
                    >>> End Class
                    >>>
                    >>>
                    >>>
                    >>>
                    >>> "AMDRIT" <amdrit@hotmail .com> wrote in message
                    >>> news:OpMDndkNGH A.2064@TK2MSFTN GP09.phx.gbl...
                    >>>> Ok, first the isue you were having with the "Blue lines" is:
                    >>>>
                    >>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                    >>>> ParameterDiscre teValue()
                    >>>> --> Retun type is expecting an array of ParameterDiscre teValue
                    >>>>
                    >>>> it should be
                    >>>>
                    >>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                    >>>> ParameterDiscre teValue
                    >>>> --> Retun type is expecting an single ParameterDiscre teValue
                    >>>>
                    >>>> Second (Mostly because I was bored and also because I am still a
                    >>>> novice), I have altered your code yet again.
                    >>>>
                    >>>>
                    >>>> Private Enum FileNameFormats
                    >>>> SessionID = 0
                    >>>> GUIDDashes = 1
                    >>>> GUIDNoDashes = 2
                    >>>> End Enum
                    >>>>
                    >>>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles MyBase.Init
                    >>>> 'CODEGEN: This method call is required by the Web Form Designer
                    >>>> 'Do not modify it using the code editor.
                    >>>> InitializeCompo nent()
                    >>>>
                    >>>> Dim myReport As RapportAIRCOSto ringen
                    >>>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                    >>>>
                    >>>> Try
                    >>>>
                    >>>> Try
                    >>>> PrepareReport(m yReport)
                    >>>> Catch ex As Exception
                    >>>> Dim exc As ApplicationExce ption
                    >>>> exc = New ApplicationExce ption("Unable to prepare report.", ex)
                    >>>> Throw exc
                    >>>> End Try
                    >>>>
                    >>>> Try
                    >>>> 'exporteren to pdf
                    >>>> myExportOptions = GetExportOption s(FileNameForma ts.GUIDNoDashes ,
                    >>>> CType(myReport,
                    >>>> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                    >>>> myReport.Export ()
                    >>>>
                    >>>> Catch ex As Exception
                    >>>> Dim exc As ApplicationExce ption
                    >>>> exc = New ApplicationExce ption("Unable to export report.", ex)
                    >>>> Throw exc
                    >>>> End Try
                    >>>>
                    >>>> crViewer.Report Source = myReport
                    >>>>
                    >>>> Session("export bestand") =
                    >>>> CType(myExportO ptions.Destinat ionOptions,
                    >>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                    >>>>
                    >>>> Catch err As Exception
                    >>>> Response.Write( "<BR>")
                    >>>> Response.Write( err.Message.ToS tring)
                    >>>> End Try
                    >>>>
                    >>>> End Sub
                    >>>>
                    >>>> #Region "Page Implementation"
                    >>>>
                    >>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles MyBase.Load
                    >>>> 'Put user code to initialize the page here
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                    >>>> System.EventArg s) Handles MyBase.Unload
                    >>>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                    >>>> String)
                    >>>>
                    >>>> System.IO.File. Delete(myExport File)
                    >>>> End Sub
                    >>>>
                    >>>> #End Region
                    >>>>
                    >>>> #Region "Report Setup"
                    >>>>
                    >>>> Private Sub PrepareReport(B yVal myReport As
                    >>>> CrystalDecision s.CrystalReport s.Engine.Report Document)
                    >>>>
                    >>>> Dim paramFields As ParameterFields
                    >>>> Dim paramField As ParameterField
                    >>>>
                    >>>> Const SessionExecptio n As String = "Unable to read session objects."
                    >>>>
                    >>>> Try
                    >>>>
                    >>>> paramFields = New ParameterFields
                    >>>> Try
                    >>>> paramField = CreateParameter ("FiliaalKeuze" )
                    >>>>
                    >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                    >>>>
                    >>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" DiscreteValue1" )))
                    >>>> Catch ex As Exception
                    >>>> Dim exc As System.Applicat ionException
                    >>>> exc = New System.Applicat ionException(Se ssionExecption, ex)
                    >>>> Throw exc
                    >>>> End Try
                    >>>>
                    >>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                    >>>>
                    >>>> Try
                    >>>> 'Todo wrap in try
                    >>>> paramField = CreateParameter ("Periode")
                    >>>>
                    >>>> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                    >>>> GetSessionValue ("EindPeriode") ))
                    >>>> Catch ex As Exception
                    >>>> Dim exc As System.Applicat ionException
                    >>>> exc = New System.Applicat ionException(Se ssionExecption, ex)
                    >>>> Throw exc
                    >>>> End Try
                    >>>>
                    >>>> myReport.SetPar ameterValue("Pe riode", paramField)
                    >>>>
                    >>>> Catch ex As Exception
                    >>>>
                    >>>> Dim exc As System.Applicat ionException
                    >>>> exc = New System.Applicat ionException("U nable to set paramater
                    >>>> value.", ex)
                    >>>> Throw exc
                    >>>>
                    >>>> End Try
                    >>>>
                    >>>>
                    >>>> End Sub
                    >>>>
                    >>>> Private Function CreateParameter (ByVal ParameterName As String) As
                    >>>> ParameterField
                    >>>> Dim paramField As ParameterField
                    >>>>
                    >>>> paramField = New ParameterField
                    >>>> paramField.Para meterFieldName = ParameterName
                    >>>>
                    >>>> Return paramField
                    >>>>
                    >>>> End Function
                    >>>>
                    >>>> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                    >>>> As ParameterDiscre teValue()
                    >>>>
                    >>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                    >>>> paramDiscreteVa lue = New ParameterDiscre teValue
                    >>>> paramDiscreteVa lue = Value
                    >>>>
                    >>>> 'Return paramDiscreteVa lue
                    >>>>
                    >>>> End Function
                    >>>>
                    >>>> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                    >>>> ByVal EndRange As Object) As ParameterRangeV alue
                    >>>> Dim paramRangeValue As ParameterRangeV alue
                    >>>>
                    >>>> paramRangeValue = New ParameterRangeV alue
                    >>>>
                    >>>> paramRangeValue .StartValue = StartRange
                    >>>> paramRangeValue .EndValue = EndRange
                    >>>>
                    >>>> Return paramRangeValue
                    >>>> End Function
                    >>>>
                    >>>> #End Region
                    >>>>
                    >>>> #Region "Report Export"
                    >>>>
                    >>>> Private Function GetExportOption s(ByVal UniqueFormat As
                    >>>> FileNameFormats , ByVal ExportOptions As
                    >>>> CrystalDecision s.Shared.Export Options) As
                    >>>> CrystalDecision s.Shared.Export Options
                    >>>>
                    >>>> Dim myExportFile As String
                    >>>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                    >>>> Dim myDiskFileDesti nationOptions As
                    >>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>>>
                    >>>> Try
                    >>>>
                    >>>> Select Case UniqueFormat
                    >>>> Case FileNameFormats .SessionID
                    >>>> myExportFile = Session.Session ID.ToString
                    >>>> Case FileNameFormats .GUIDDashes
                    >>>> myExportFile = System.Guid.New Guid.ToString(" D")
                    >>>> Case FileNameFormats .GUIDNoDashes
                    >>>> myExportFile = System.Guid.New Guid.ToString(" N")
                    >>>> End Select
                    >>>>
                    >>>> myExportFile = System.IO.Path. Combine(GetExpo rtRoot,
                    >>>> String.Format(" PDF_{0}.pdf", myExportFile))
                    >>>>
                    >>>> myDiskFileDesti nationOptions = New
                    >>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                    >>>>
                    >>>> myExportOptions = ExportOptions
                    >>>>
                    >>>> With myExportOptions
                    >>>> .DestinationOpt ions = myDiskFileDesti nationOptions
                    >>>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                    >>>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                    >>>> End With
                    >>>>
                    >>>> Catch ex As Exception
                    >>>>
                    >>>> Dim exc As System.Applicat ionException
                    >>>> exc = New System.Applicat ionException("U nable to prepare export
                    >>>> options.", ex)
                    >>>> Throw exc
                    >>>>
                    >>>> End Try
                    >>>>
                    >>>> Return myExportOptions
                    >>>>
                    >>>> End Function
                    >>>>
                    >>>> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                    >>>> String
                    >>>>
                    >>>> Dim strExportRoot As String
                    >>>>
                    >>>> If FromApplication Then
                    >>>> Try
                    >>>> Application.loc k()
                    >>>> strExportRoot = Application("Re portExportRoot" )
                    >>>> Catch ex As Exception
                    >>>> Dim exc As ApplicationExce ption
                    >>>> exc = New ApplicationExce ption("Unable to lock Web Application
                    >>>> for read.", ex)
                    >>>> Throw exc
                    >>>> Finally
                    >>>> Application.unl ock()
                    >>>> End Try
                    >>>> Else
                    >>>> strExportRoot = Session("Report ExportRoot")
                    >>>> End If
                    >>>>
                    >>>> Return strExportRoot
                    >>>>
                    >>>> End Function
                    >>>>
                    >>>> #End Region
                    >>>>
                    >>>> #Region "Navigation Implementation"
                    >>>>
                    >>>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles cmdPrint.Click
                    >>>>
                    >>>> Response.ClearC ontent()
                    >>>> Response.ClearH eaders()
                    >>>> Response.Conten tType = "applicatio n/pdf"
                    >>>>
                    >>>> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                    >>>> String)
                    >>>>
                    >>>> Response.WriteF ile(myExportFil e)
                    >>>> Response.Flush( )
                    >>>> Response.Close( )
                    >>>>
                    >>>> System.IO.File. Delete(myExport File)
                    >>>>
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles cmdEerste.Click
                    >>>> crViewer.ShowFi rstPage()
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles cmdLaatste.Clic k
                    >>>> crViewer.ShowLa stPage()
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles cmdTerug.Click
                    >>>> crViewer.ShowPr eviousPage()
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                    >>>> System.EventArg s) Handles cmdVerder.Click
                    >>>> crViewer.ShowNe xtPage()
                    >>>> End Sub
                    >>>>
                    >>>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
                    >>>> e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                    >>>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                    >>>> End Sub
                    >>>>
                    >>>> #End Region
                    >>>>
                    >>>>
                    >>>> "Alison Givens" <info@cross-it.nl> wrote in message
                    >>>> news:%23RW%23bs jNGHA.2124@TK2M SFTNGP14.phx.gb l...
                    >>>>>> Perhaps you could share your resulting code for comparison? Did you
                    >>>>>> see that I suggested the error in your code was
                    >>>>>>
                    >>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal) 'You only
                    >>>>>> call this statement once (Effectively 2344) but you wanted two
                    >>>>>> values.
                    >>>>>
                    >>>>> To get the thing going, it would be enough for me at first to know how
                    >>>>> to call the statement twice, so the other value is forwarded too.
                    >>>>> (btw, these two values will be SessionObjects two, but I did it
                    >>>>> hardcoded for testing)
                    >>>>> Best would be ofcourse that I learn to do it 'clean' of course. I am a
                    >>>>> real newbee at this.
                    >>>>>
                    >>>>> Here is the rest of my code:
                    >>>>>
                    >>>>> Imports CrystalDecision s.CrystalReport s.Engine
                    >>>>> Imports CrystalDecision s.CrystalReport s.Engine.Report Document
                    >>>>> Imports CrystalDecision s.Shared
                    >>>>> Imports System.IO
                    >>>>>
                    >>>>>
                    >>>>> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                    >>>>> System.EventArg s) Handles MyBase.Init
                    >>>>> 'CODEGEN: This method call is required by the Web Form Designer
                    >>>>> 'Do not modify it using the code editor.
                    >>>>> InitializeCompo nent()
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>> Dim myReport As RapportAIRCOSto ringen
                    >>>>> Dim paramFields As ParameterFields
                    >>>>> Dim paramField As ParameterField
                    >>>>>
                    >>>>> Dim BeginPeriode As String
                    >>>>> Dim EindPeriode As String
                    >>>>>
                    >>>>> 'Todo wrap everything in try
                    >>>>> paramFields = New ParameterFields
                    >>>>>
                    >>>>> Try
                    >>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                    >>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                    >>>>> Catch ex As Exception
                    >>>>> Dim exCustom As ApplicationExce ption
                    >>>>> exCustom = New ApplicationExce ption("Unable to parse Query
                    >>>>> Paramaters.", ex)
                    >>>>> Throw exCustom
                    >>>>> End Try
                    >>>>>
                    >>>>> 'Todo wrap in try
                    >>>>> paramField = CreateParameter ("FiliaalKeuze" )
                    >>>>>
                    >>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                    >>>>>
                    >>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                    >>>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                    >>>>>
                    >>>>>
                    >>>>> 'Todo wrap in try
                    >>>>> paramField = CreateParameter ("Periode")
                    >>>>>
                    >>>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                    >>>>> EindPeriode))
                    >>>>> myReport.SetPar ameterValue("Pe riode", paramField)
                    >>>>>
                    >>>>>
                    >>>>> crViewer.Report Source = myReport
                    >>>>>
                    >>>>>
                    >>>>> 'exporteren to pdf
                    >>>>> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                    >>>>> Dim myDiskFileDesti nationOptions As
                    >>>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>>>> Dim myExportFile As String
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>> myExportFile = "\\192.168.2.10 6\syn2sql$\PDF_ " &
                    >>>>> Session.Session ID.ToString & ".pdf"
                    >>>>> myDiskFileDesti nationOptions = New
                    >>>>> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                    >>>>> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                    >>>>> myExportOptions = myReport.Export Options
                    >>>>> With myExportOptions
                    >>>>> .DestinationOpt ions = myDiskFileDesti nationOptions
                    >>>>> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                    >>>>> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                    >>>>> End With
                    >>>>>
                    >>>>> Try
                    >>>>> myReport.Export ()
                    >>>>> Catch err As Exception
                    >>>>> Response.Write( "<BR>")
                    >>>>> Response.Write( err.Message.ToS tring)
                    >>>>> End Try
                    >>>>>
                    >>>>> Session("export bestand") = myExportFile
                    >>>>> End Sub
                    >>>>>
                    >>>>> #End Region
                    >>>>>
                    >>>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                    >>>>> System.EventArg s) Handles MyBase.Load
                    >>>>> 'Put user code to initialize the page here
                    >>>>> End Sub
                    >>>>> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e
                    >>>>> As System.EventArg s) Handles cmdPrint.Click
                    >>>>> Response.ClearC ontent()
                    >>>>> Response.ClearH eaders()
                    >>>>> Response.Conten tType = "applicatio n/pdf"
                    >>>>> Dim myExportFile As String =
                    >>>>> CType(Session.I tem("exportbest and"), String)
                    >>>>>
                    >>>>> Response.WriteF ile(myExportFil e)
                    >>>>> Response.Flush( )
                    >>>>> Response.Close( )
                    >>>>>
                    >>>>> System.IO.File. Delete(myExport File)
                    >>>>> End Sub
                    >>>>>
                    >>>>> Private Function CreateParameter (ByVal ParameterName As String) As
                    >>>>> ParameterField( )
                    >>>>> Dim paramField As ParameterField
                    >>>>>
                    >>>>> paramField = New ParameterField
                    >>>>> paramField.Para meterFieldName = ParameterName
                    >>>>>
                    >>>>> 'Return paramField
                    >>>>>
                    >>>>> End Function
                    >>>>>
                    >>>>> Private Function CreateParameter DiscreteValue(B yVal Value As
                    >>>>> Object) As ParameterDiscre teValue()
                    >>>>>
                    >>>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                    >>>>> paramDiscreteVa lue = New ParameterDiscre teValue
                    >>>>> paramDiscreteVa lue = Value
                    >>>>>
                    >>>>> 'Return paramDiscreteVa lue
                    >>>>>
                    >>>>> End Function
                    >>>>>
                    >>>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                    >>>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                    >>>>> Dim paramRangeValue As ParameterRangeV alue
                    >>>>>
                    >>>>> paramRangeValue = New ParameterRangeV alue
                    >>>>>
                    >>>>> paramRangeValue .StartValue = StartRange
                    >>>>> paramRangeValue .EndValue = EndRange
                    >>>>>
                    >>>>> Return paramRangeValue
                    >>>>> End Function
                    >>>>>
                    >>>>>
                    >>>>> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e
                    >>>>> As System.EventArg s) Handles cmdEerste.Click
                    >>>>> crViewer.ShowFi rstPage()
                    >>>>> End Sub
                    >>>>>
                    >>>>> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e
                    >>>>> As System.EventArg s) Handles cmdLaatste.Clic k
                    >>>>> crViewer.ShowLa stPage()
                    >>>>> End Sub
                    >>>>>
                    >>>>> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e
                    >>>>> As System.EventArg s) Handles cmdTerug.Click
                    >>>>> crViewer.ShowPr eviousPage()
                    >>>>> End Sub
                    >>>>>
                    >>>>> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e
                    >>>>> As System.EventArg s) Handles cmdVerder.Click
                    >>>>> crViewer.ShowNe xtPage()
                    >>>>> End Sub
                    >>>>>
                    >>>>> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object,
                    >>>>> ByVal e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                    >>>>> crViewer.Zoom(d rpZoom.Selected Item.Value)
                    >>>>> End Sub
                    >>>>> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                    >>>>> System.EventArg s) Handles MyBase.Unload
                    >>>>> Dim myExportFile As String =
                    >>>>> CType(Session.I tem("exportbest and"), String)
                    >>>>>
                    >>>>> System.IO.File. Delete(myExport File)
                    >>>>> End Sub
                    >>>>> End Class
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>
                    >>>>>>
                    >>>>>> "Alison Givens" <info@cross-it.nl> wrote in message
                    >>>>>> news:eeEqNEgNGH A.1288@TK2MSFTN GP09.phx.gbl...
                    >>>>>>> When I use your solution I get blue lines under the text like this
                    >>>>>>>
                    >>>>>>> paramField = CreateParamater ("FiliaalKeuze" )
                    >>>>>>> The text is:
                    >>>>>>> Value of type '1 dimensional array of
                    >>>>>>> CrystalDecision s.Shared.Parame terField' cannot be converted
                    >>>>>>> to 'Crystal.Decisi ons.Shared.Para meterField'
                    >>>>>>>
                    >>>>>>> Return paramField
                    >>>>>>> The text is:
                    >>>>>>> Value of type 'CrystalDecisio ns.Shared.Param eterField' cannot be
                    >>>>>>> converted
                    >>>>>>> to '1 dimensional array of Crystal.Decisio ns.Shared.Param eterField'
                    >>>>>>>
                    >>>>>>> Same for
                    >>>>>>> paramField = CreateParamater ("Periode")
                    >>>>>>> Return paramDiscreteVa lue
                    >>>>>>>
                    >>>>>>> Any idea what causes this?
                    >>>>>>>
                    >>>>>>> Alison
                    >>>>>>>
                    >>>>>>>
                    >>>>>>> "AMDRIT" <amdrit@hotmail .com> wrote in message
                    >>>>>>> news:urCzE10MGH A.720@TK2MSFTNG P14.phx.gbl...
                    >>>>>>>> Wow, you do all that for Crystal Reports? What is
                    >>>>>>>> RapportAIRCOSto ringen?
                    >>>>>>>>
                    >>>>>>>>
                    >>>>>>>> Here is all I do for CR
                    >>>>>>>>
                    >>>>>>>> Dim x As CrystalDecision s.CrystalReport s.Engine.Report Document
                    >>>>>>>>
                    >>>>>>>> x.Load(sReportP ath) 'Reports are not embedded resources
                    >>>>>>>> x.SetParameterV alue("Paramater 1", Paramaters(1)) 'Dynamic
                    >>>>>>>> Paramaters
                    >>>>>>>> x.SetParameterV alue("Paramater 2", Paramaters(2))
                    >>>>>>>> x.SetDataSource (mydata) 'Strongly Typed Datasets
                    >>>>>>>>
                    >>>>>>>> Me.CrystalRepor tViewer1.Report Source = x
                    >>>>>>>> Me.CrystalRepor tViewer1.PrintR eport()
                    >>>>>>>>
                    >>>>>>>>
                    >>>>>>>> 'Now to answer your question about your code, hmm
                    >>>>>>>>
                    >>>>>>>> Ok, first
                    >>>>>>>>
                    >>>>>>>> Never --> Dim x as new object
                    >>>>>>>> 'This is silly, lazy and unprofessional. So if you are in
                    >>>>>>>> high school, keep the course.
                    >>>>>>>>
                    >>>>>>>>
                    >>>>>>>> Instead --> Dim x as object
                    >>>>>>>> Set x = new object
                    >>>>>>>> 'Reserve your space and contract
                    >>>>>>>> 'Then make use of it.
                    >>>>>>>>
                    >>>>>>>> I think this is your problem
                    >>>>>>>>
                    >>>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                    >>>>>>>>
                    >>>>>>>> Why are you setting the crView paramaters and the myReport
                    >>>>>>>> paramaters?
                    >>>>>>>> -->crViewer.Param eterFieldInfo = paramFields
                    >>>>>>>> -->myReport.SetPa rameterValue("P eriode", rangeVal)
                    >>>>>>>>
                    >>>>>>>> I think that myReport is the only think that needs to be set
                    >>>>>>>>
                    >>>>>>>>
                    >>>>>>>> I had to spent time reading your code to understand what you were
                    >>>>>>>> doing.
                    >>>>>>>>
                    >>>>>>>> Here is an attempt to clean it up.
                    >>>>>>>>
                    >>>>>>>> Private Sub TestIT()
                    >>>>>>>>
                    >>>>>>>> Dim myReport As RapportAIRCOSto ringen
                    >>>>>>>> Dim paramFields As ParameterFields
                    >>>>>>>> Dim paramField As ParameterField
                    >>>>>>>>
                    >>>>>>>> Dim BeginPeriode As String
                    >>>>>>>> Dim EindPeriode As String
                    >>>>>>>>
                    >>>>>>>> 'Todo wrap everything in try
                    >>>>>>>> paramFields = New ParameterFields
                    >>>>>>>>
                    >>>>>>>> Try
                    >>>>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                    >>>>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                    >>>>>>>> Catch ex As Exception
                    >>>>>>>> Dim exCustom As ApplicationExce ption
                    >>>>>>>> exCustom = New ApplicationExce ption("Unable to parse Query
                    >>>>>>>> Paramaters.", ex)
                    >>>>>>>> Throw exCustom
                    >>>>>>>> End Try
                    >>>>>>>>
                    >>>>>>>> 'Todo wrap in try
                    >>>>>>>> paramField = CreateParamater ("FiliaalKeuze" )
                    >>>>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(20 44))
                    >>>>>>>> paramField.Curr entValues.Add(C reateParameterD iscreteValue(23 44))
                    >>>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                    >>>>>>>> 'paramFields.Ad d(paramField) --> Not needed
                    >>>>>>>>
                    >>>>>>>> 'Todo wrap in try
                    >>>>>>>> paramField = CreateParamater ("Periode")
                    >>>>>>>>
                    >>>>>>>> paramField.Curr entValues.Add(C reateParameterR angeValue(Begin Periode,
                    >>>>>>>> EindPeriode))
                    >>>>>>>> myReport.SetPar ameterValue("Pe riode", paramField)
                    >>>>>>>> 'paramFields.Ad d(paramField)--> Not needed
                    >>>>>>>>
                    >>>>>>>> 'Todo wrap in try, i don't think you need this
                    >>>>>>>> 'myReport.SetPa rameterValue("P eriode", rangeVal)
                    >>>>>>>> 'myReport.SetPa rameterValue("F iliaalKeuze", discreteVal)
                    >>>>>>>>
                    >>>>>>>> 'Todo, determine if we need this step; I don't think you do
                    >>>>>>>> 'crViewer.Param eterFieldInfo = paramFields
                    >>>>>>>>
                    >>>>>>>> crViewer.Report Source = myReport
                    >>>>>>>>
                    >>>>>>>> End Sub
                    >>>>>>>>
                    >>>>>>>> Private Function CreateParamater (ByVal ParamaterName As String) As
                    >>>>>>>> ParameterField
                    >>>>>>>> Dim paramField As ParameterField
                    >>>>>>>>
                    >>>>>>>> paramField = New ParameterField
                    >>>>>>>> paramField.Para meterFieldName = ParamaterName
                    >>>>>>>>
                    >>>>>>>> Return paramField
                    >>>>>>>>
                    >>>>>>>> End Function
                    >>>>>>>>
                    >>>>>>>> Private Function CreateParameter DiscreteValue(B yVal Value As
                    >>>>>>>> Object) As ParameterDiscre teValue
                    >>>>>>>>
                    >>>>>>>> Dim paramDiscreteVa lue As ParameterDiscre teValue
                    >>>>>>>> paramDiscreteVa lue = New ParameterDiscre teValue
                    >>>>>>>> paramDiscreteVa lue = Value
                    >>>>>>>>
                    >>>>>>>> Return paramDiscreteVa lue
                    >>>>>>>>
                    >>>>>>>> End Function
                    >>>>>>>>
                    >>>>>>>> Private Function CreateParameter RangeValue(ByVa l StartRange As
                    >>>>>>>> Object, ByVal EndRange As Object) As ParameterRangeV alue
                    >>>>>>>> Dim paramRangeValue As ParameterRangeV alue
                    >>>>>>>>
                    >>>>>>>> paramRangeValue = New ParameterRangeV alue
                    >>>>>>>>
                    >>>>>>>> paramRangeValue .StartValue = StartRange
                    >>>>>>>> paramRangeValue .EndValue = EndRange
                    >>>>>>>>
                    >>>>>>>> Return paramRangeValue
                    >>>>>>>> End Function
                    >>>>>>>>
                    >>>>>>>> "Alison Givens" <info@cross-it.nl> wrote in message
                    >>>>>>>> news:eW4b66tMGH A.668@TK2MSFTNG P11.phx.gbl...
                    >>>>>>>>> ...... that nobody knows the answer.
                    >>>>>>>>> I can't imagine that I am the only one that uses parameters in CR.
                    >>>>>>>>>
                    >>>>>>>>> So, my question again:
                    >>>>>>>>>
                    >>>>>>>>> I have the following problem.
                    >>>>>>>>> (VB.NET 2003 with CR)
                    >>>>>>>>>
                    >>>>>>>>> I have a report with a multiple-value discrete value and a
                    >>>>>>>>> rangevalue.
                    >>>>>>>>> The report shows fine in the viewer, but when I hit the export to
                    >>>>>>>>> pdf
                    >>>>>>>>> button, it only uses one of two discrete values.
                    >>>>>>>>>
                    >>>>>>>>> This is the code:
                    >>>>>>>>> Dim BeginPeriode As String
                    >>>>>>>>> Dim EindPeriode As String
                    >>>>>>>>>
                    >>>>>>>>> BeginPeriode = Request.QuerySt ring("BeginPeri ode")
                    >>>>>>>>> EindPeriode = Request.QuerySt ring("EindPerio de")
                    >>>>>>>>>
                    >>>>>>>>> Dim myReport As New RapportAIRCOSto ringen
                    >>>>>>>>>
                    >>>>>>>>> Dim paramFields As New ParameterFields
                    >>>>>>>>> Dim paramField As New ParameterField
                    >>>>>>>>> Dim discreteVal As New ParameterDiscre teValue
                    >>>>>>>>> Dim rangeVal As New ParameterRangeV alue
                    >>>>>>>>>
                    >>>>>>>>> paramField.Para meterFieldName = "FiliaalKeu ze"
                    >>>>>>>>> discreteVal.Val ue = "2044"
                    >>>>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                    >>>>>>>>>
                    >>>>>>>>> discreteVal = New ParameterDiscre teValue
                    >>>>>>>>> discreteVal.Val ue = "2344"
                    >>>>>>>>> paramField.Curr entValues.Add(d iscreteVal)
                    >>>>>>>>>
                    >>>>>>>>> paramFields.Add (paramField)
                    >>>>>>>>>
                    >>>>>>>>> paramField = New ParameterField
                    >>>>>>>>>
                    >>>>>>>>> paramField.Para meterFieldName = "Periode"
                    >>>>>>>>>
                    >>>>>>>>> rangeVal.StartV alue = BeginPeriode
                    >>>>>>>>> rangeVal.EndVal ue = EindPeriode
                    >>>>>>>>> paramField.Curr entValues.Add(r angeVal)
                    >>>>>>>>>
                    >>>>>>>>> paramFields.Add (paramField)
                    >>>>>>>>>
                    >>>>>>>>> crViewer.Parame terFieldInfo = paramFields
                    >>>>>>>>> myReport.SetPar ameterValue("Pe riode", rangeVal)
                    >>>>>>>>> myReport.SetPar ameterValue("Fi liaalKeuze", discreteVal)
                    >>>>>>>>> crViewer.Report Source = myReport
                    >>>>>>>>>
                    >>>>>>>>> As you can see I use myReport.SetPar ameterValue to feed the pdf.
                    >>>>>>>>> It goes wrong with the discrete value. It only sees the second
                    >>>>>>>>> value I
                    >>>>>>>>> entered and not the first.
                    >>>>>>>>> How can I get this going?
                    >>>>>>>>>
                    >>>>>>>>>
                    >>>>>>>>> Kind regards,
                    >>>>>>>>> Alison
                    >>>>>>>>>
                    >>>>>>>>>
                    >>>>>>>>>
                    >>>>>>>>>
                    >>>>>>>>
                    >>>>>>>>
                    >>>>>>>
                    >>>>>>>
                    >>>>>>
                    >>>>>>
                    >>>>>
                    >>>>>
                    >>>>
                    >>>>
                    >>>
                    >>>[/color]
                    >>
                    >>[/color]
                    >
                    >[/color]


                    Comment

                    • Alison Givens

                      #11
                      Re: How is it possible ...

                      Yepper, the web.config is case sensitive.
                      That solves that problem.
                      Next problem:
                      When I give in the parameters and go to the form that holds the report I get
                      this:

                      Value cannot be null. Parameter name: path
                      Description: An unhandled exception occurred during the execution of the
                      current web request.

                      Exception Details: System.Argument NullException: Value cannot be null.
                      Parameter name: path

                      Source Error:


                      Line 84: Dim myExportFile As String =
                      CType(Session.I tem("exportbest and"), String)
                      Line 85:
                      Line 86: System.IO.File. Delete(myExport File)
                      Line 87: End Sub
                      Line 88:

                      I commented it, so I could at least try to go further.
                      Then when the form with the report loads, I get:
                      Unable to prepare report.

                      This comes out of this error handeling:
                      Try
                      PrepareReport(m yReport)
                      Catch ex As Exception
                      Dim exc As ApplicationExce ption
                      exc = New ApplicationExce ption("Unable to prepare report.", ex)
                      Throw exc
                      End Try

                      To be accurate I will put the entire current code here:


                      Private Enum FileNameFormats
                      SessionID = 0
                      GUIDDashes = 1
                      GUIDNoDashes = 2
                      End Enum



                      Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles MyBase.Init
                      'CODEGEN: This method call is required by the Web Form Designer
                      'Do not modify it using the code editor.
                      InitializeCompo nent()
                      Dim myReport As RapportAIRCOSto ringen
                      Dim myExportOptions As CrystalDecision s.Shared.Export Options

                      Try

                      Try
                      PrepareReport(m yReport)
                      Catch ex As Exception
                      Dim exc As System.Applicat ionException
                      exc = New System.Applicat ionException("U nable to prepare
                      report.", ex)
                      Throw exc
                      End Try

                      Try
                      'exporteren to pdf
                      myExportOptions =
                      GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                      CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                      myReport.Export ()

                      Catch ex As Exception
                      Dim exc As ApplicationExce ption
                      exc = New ApplicationExce ption("Unable to export report.",
                      ex)
                      Throw exc
                      End Try

                      crViewer.Report Source = myReport

                      Session("export bestand") =
                      CType(myExportO ptions.Destinat ionOptions,
                      CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name

                      Catch err As Exception
                      Response.Write( "<BR>")
                      Response.Write( err.Message.ToS tring)
                      End Try




                      End Sub

                      #End Region

                      #Region "Page Implementation"

                      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles MyBase.Load
                      'Put user code to initialize the page here
                      End Sub

                      Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                      System.EventArg s) Handles MyBase.Unload
                      'Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                      String)

                      'System.IO.File .Delete(myExpor tFile)
                      End Sub

                      #End Region

                      #Region "Report Setup"

                      Private Sub PrepareReport(B yVal myReport As
                      CrystalDecision s.CrystalReport s.Engine.Report Document)

                      Dim paramFields As ParameterFields
                      Dim paramField As ParameterField

                      Const SessionExecptio n As String = "Unable to read session objects."

                      Try

                      paramFields = New ParameterFields
                      Try
                      paramField = CreateParameter ("FiliaalKeuze" )
                      paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" Filiaal")))
                      'paramField.Cur rentValues.Add( CreateParameter DiscreteValue(G etSessionValue( "DiscreteValue2 ")))
                      Catch ex As Exception
                      Dim exc As ApplicationExce ption
                      exc = New ApplicationExce ption(SessionEx ecption, ex)
                      Throw exc
                      End Try

                      myReport.SetPar ameterValue("Fi liaalKeuze", paramField)

                      Try
                      'Todo wrap in try
                      paramField = CreateParameter ("Periode")
                      paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                      GetSessionValue ("EindPeriode") ))
                      Catch ex As Exception
                      Dim exc As System.Applicat ionException
                      exc = New System.Applicat ionException(Se ssionExecption, ex)
                      Throw exc
                      End Try

                      myReport.SetPar ameterValue("Pe riode", paramField)

                      Catch ex As Exception

                      Dim exc As System.Applicat ionException
                      exc = New System.Applicat ionException("U nable to set
                      paramatervalue. ", ex)
                      Throw exc

                      End Try


                      End Sub

                      Private Function CreateParameter (ByVal ParameterName As String) As
                      ParameterField
                      Dim paramField As ParameterField

                      paramField = New ParameterField
                      paramField.Para meterFieldName = ParameterName

                      Return paramField

                      End Function


                      Private Function GetSessionValue (ByVal KeyName As String) As Object
                      Try
                      Return Session.Item(Ke yName)
                      Catch ex As Exception
                      Dim exc As ApplicationExce ption
                      exc = New ApplicationExce ption(String.Fo rmat("Unable to read
                      value from session:{0}", KeyName), ex)
                      Throw exc
                      End Try

                      End Function



                      Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                      ParameterDiscre teValue

                      Dim paramDiscreteVa lue As ParameterDiscre teValue
                      paramDiscreteVa lue = New ParameterDiscre teValue
                      paramDiscreteVa lue = Value

                      Return paramDiscreteVa lue

                      End Function

                      Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                      ByVal EndRange As Object) As ParameterRangeV alue
                      Dim paramRangeValue As ParameterRangeV alue

                      paramRangeValue = New ParameterRangeV alue

                      paramRangeValue .StartValue = StartRange
                      paramRangeValue .EndValue = EndRange

                      Return paramRangeValue
                      End Function

                      #End Region

                      #Region "Report Export"

                      Private Function GetExportOption s(ByVal UniqueFormat As FileNameFormats ,
                      ByVal ExportOptions As CrystalDecision s.Shared.Export Options) As
                      CrystalDecision s.Shared.Export Options

                      Dim myExportFile As String
                      Dim myExportOptions As CrystalDecision s.Shared.Export Options
                      Dim myDiskFileDesti nationOptions As
                      CrystalDecision s.Shared.DiskFi leDestinationOp tions

                      Try

                      Select Case UniqueFormat
                      Case FileNameFormats .SessionID
                      myExportFile = Session.Session ID.ToString
                      Case FileNameFormats .GUIDDashes
                      myExportFile = System.Guid.New Guid.ToString(" D")
                      Case FileNameFormats .GUIDNoDashes
                      myExportFile = System.Guid.New Guid.ToString(" N")
                      End Select

                      myExportFile = System.IO.Path. Combine(GetExpo rtRoot(True),
                      String.Format(" PDF_{0}.pdf", myExportFile))
                      myDiskFileDesti nationOptions = New
                      CrystalDecision s.Shared.DiskFi leDestinationOp tions
                      myDiskFileDesti nationOptions.D iskFileName = myExportFile

                      myExportOptions = ExportOptions

                      With myExportOptions
                      .DestinationOpt ions = myDiskFileDesti nationOptions
                      .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                      .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                      End With

                      Catch ex As Exception

                      Dim exc As System.Applicat ionException
                      exc = New System.Applicat ionException("U nable to prepare export
                      options.", ex)
                      Throw exc

                      End Try

                      Return myExportOptions

                      End Function

                      Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                      String

                      Dim strExportRoot As String

                      If FromApplication Then
                      Try
                      Application.Loc k()
                      strExportRoot = Application("Re portExportRoot" )
                      Catch ex As Exception
                      Dim exc As ApplicationExce ption
                      exc = New ApplicationExce ption("Unable to lock Web
                      Application for read.", ex)
                      Throw exc
                      Finally
                      Application.UnL ock()
                      End Try
                      Else
                      strExportRoot = Session("Report ExportRoot")
                      End If

                      Return strExportRoot

                      End Function

                      #End Region

                      #Region "Navigation Implementation"

                      Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles cmdPrint.Click

                      Response.ClearC ontent()
                      Response.ClearH eaders()
                      Response.Conten tType = "applicatio n/pdf"

                      Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                      String)

                      Response.WriteF ile(myExportFil e)
                      Response.Flush( )
                      Response.Close( )

                      System.IO.File. Delete(myExport File)

                      End Sub

                      Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles cmdEerste.Click
                      crViewer.ShowFi rstPage()
                      End Sub

                      Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles cmdLaatste.Clic k
                      crViewer.ShowLa stPage()
                      End Sub

                      Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles cmdTerug.Click
                      crViewer.ShowPr eviousPage()
                      End Sub

                      Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                      System.EventArg s) Handles cmdVerder.Click
                      crViewer.ShowNe xtPage()
                      End Sub

                      Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal e
                      As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                      crViewer.Zoom(d rpZoom.Selected Item.Value)
                      End Sub

                      #End Region


                      Comment

                      • AMDRIT

                        #12
                        Re: How is it possible ...

                        I challenge you to consider what is going on and ask why would that type of
                        exception occur.

                        It appears that in your Page_Unload() you are attempting to do clean up.

                        Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                        System.EventArg s) Handles MyBase.Unload
                        Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                        String)
                        System.IO.File. Delete(myExport File)
                        End Sub

                        The problem is that the Session item "exportbest and" appears to be
                        string.empty. Perhaps, the value was never properly set.

                        The only place I see that you are setting the Session item is in page_init()

                        Session("export bestand") = CType _
                        (myExportOption s.DestinationOp tions,
                        CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name

                        You should test to see if DiskFileName has value, and if not, then work
                        backwards to where it is set to determine if a value is being set there.


                        Next, consider why the page_unload is firing without first displaying your
                        report.

                        try something like this in you error handling routine:

                        Try
                        PrepareReport(m yReport)
                        Catch ex As Exception
                        dim innerEx as Exception, sb as system.text.str ingbuilder
                        sb = new system.text.str ingbuilder

                        sb.append(ex.to string)

                        innerEx = ex.innerexcepti on

                        do while not innerEx is nothing
                        sb.append(vbcrl f)
                        sb.append(inner Ex.tostring)
                        innerEx = innerEx.innerex ception
                        loop

                        response.write( sb.tostring)
                        response.end

                        'exc = New ApplicationExce ption("Unable to prepare report.", ex)
                        'Throw exc
                        End Try


                        "Alison Givens" <info@cross-it.nl> wrote in message
                        news:O0G6XiFOGH A.3576@TK2MSFTN GP15.phx.gbl...[color=blue]
                        > Yepper, the web.config is case sensitive.
                        > That solves that problem.
                        > Next problem:
                        > When I give in the parameters and go to the form that holds the report I
                        > get this:
                        >
                        > Value cannot be null. Parameter name: path
                        > Description: An unhandled exception occurred during the execution of the
                        > current web request.
                        >
                        > Exception Details: System.Argument NullException: Value cannot be null.
                        > Parameter name: path
                        >
                        > Source Error:
                        >
                        >
                        > Line 84: Dim myExportFile As String =
                        > CType(Session.I tem("exportbest and"), String)
                        > Line 85:
                        > Line 86: System.IO.File. Delete(myExport File)
                        > Line 87: End Sub
                        > Line 88:
                        >
                        > I commented it, so I could at least try to go further.
                        > Then when the form with the report loads, I get:
                        > Unable to prepare report.
                        >
                        > This comes out of this error handeling:
                        > Try
                        > PrepareReport(m yReport)
                        > Catch ex As Exception
                        > Dim exc As ApplicationExce ption
                        > exc = New ApplicationExce ption("Unable to prepare report.", ex)
                        > Throw exc
                        > End Try
                        >
                        > To be accurate I will put the entire current code here:
                        >
                        >
                        > Private Enum FileNameFormats
                        > SessionID = 0
                        > GUIDDashes = 1
                        > GUIDNoDashes = 2
                        > End Enum
                        >
                        >
                        >
                        > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles MyBase.Init
                        > 'CODEGEN: This method call is required by the Web Form Designer
                        > 'Do not modify it using the code editor.
                        > InitializeCompo nent()
                        > Dim myReport As RapportAIRCOSto ringen
                        > Dim myExportOptions As CrystalDecision s.Shared.Export Options
                        >
                        > Try
                        >
                        > Try
                        > PrepareReport(m yReport)
                        > Catch ex As Exception
                        > Dim exc As System.Applicat ionException
                        > exc = New System.Applicat ionException("U nable to prepare
                        > report.", ex)
                        > Throw exc
                        > End Try
                        >
                        > Try
                        > 'exporteren to pdf
                        > myExportOptions =
                        > GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                        > CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                        > myReport.Export ()
                        >
                        > Catch ex As Exception
                        > Dim exc As ApplicationExce ption
                        > exc = New ApplicationExce ption("Unable to export report.",
                        > ex)
                        > Throw exc
                        > End Try
                        >
                        > crViewer.Report Source = myReport
                        >
                        > Session("export bestand") =
                        > CType(myExportO ptions.Destinat ionOptions,
                        > CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                        >
                        > Catch err As Exception
                        > Response.Write( "<BR>")
                        > Response.Write( err.Message.ToS tring)
                        > End Try
                        >
                        >
                        >
                        >
                        > End Sub
                        >
                        > #End Region
                        >
                        > #Region "Page Implementation"
                        >
                        > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles MyBase.Load
                        > 'Put user code to initialize the page here
                        > End Sub
                        >
                        > Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                        > System.EventArg s) Handles MyBase.Unload
                        > 'Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                        > String)
                        >
                        > 'System.IO.File .Delete(myExpor tFile)
                        > End Sub
                        >
                        > #End Region
                        >
                        > #Region "Report Setup"
                        >
                        > Private Sub PrepareReport(B yVal myReport As
                        > CrystalDecision s.CrystalReport s.Engine.Report Document)
                        >
                        > Dim paramFields As ParameterFields
                        > Dim paramField As ParameterField
                        >
                        > Const SessionExecptio n As String = "Unable to read session
                        > objects."
                        >
                        > Try
                        >
                        > paramFields = New ParameterFields
                        > Try
                        > paramField = CreateParameter ("FiliaalKeuze" )
                        >
                        > paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" Filiaal")))
                        >
                        > 'paramField.Cur rentValues.Add( CreateParameter DiscreteValue(G etSessionValue( "DiscreteValue2 ")))
                        > Catch ex As Exception
                        > Dim exc As ApplicationExce ption
                        > exc = New ApplicationExce ption(SessionEx ecption, ex)
                        > Throw exc
                        > End Try
                        >
                        > myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                        >
                        > Try
                        > 'Todo wrap in try
                        > paramField = CreateParameter ("Periode")
                        >
                        > paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                        > GetSessionValue ("EindPeriode") ))
                        > Catch ex As Exception
                        > Dim exc As System.Applicat ionException
                        > exc = New System.Applicat ionException(Se ssionExecption, ex)
                        > Throw exc
                        > End Try
                        >
                        > myReport.SetPar ameterValue("Pe riode", paramField)
                        >
                        > Catch ex As Exception
                        >
                        > Dim exc As System.Applicat ionException
                        > exc = New System.Applicat ionException("U nable to set
                        > paramatervalue. ", ex)
                        > Throw exc
                        >
                        > End Try
                        >
                        >
                        > End Sub
                        >
                        > Private Function CreateParameter (ByVal ParameterName As String) As
                        > ParameterField
                        > Dim paramField As ParameterField
                        >
                        > paramField = New ParameterField
                        > paramField.Para meterFieldName = ParameterName
                        >
                        > Return paramField
                        >
                        > End Function
                        >
                        >
                        > Private Function GetSessionValue (ByVal KeyName As String) As Object
                        > Try
                        > Return Session.Item(Ke yName)
                        > Catch ex As Exception
                        > Dim exc As ApplicationExce ption
                        > exc = New ApplicationExce ption(String.Fo rmat("Unable to read
                        > value from session:{0}", KeyName), ex)
                        > Throw exc
                        > End Try
                        >
                        > End Function
                        >
                        >
                        >
                        > Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                        > ParameterDiscre teValue
                        >
                        > Dim paramDiscreteVa lue As ParameterDiscre teValue
                        > paramDiscreteVa lue = New ParameterDiscre teValue
                        > paramDiscreteVa lue = Value
                        >
                        > Return paramDiscreteVa lue
                        >
                        > End Function
                        >
                        > Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                        > ByVal EndRange As Object) As ParameterRangeV alue
                        > Dim paramRangeValue As ParameterRangeV alue
                        >
                        > paramRangeValue = New ParameterRangeV alue
                        >
                        > paramRangeValue .StartValue = StartRange
                        > paramRangeValue .EndValue = EndRange
                        >
                        > Return paramRangeValue
                        > End Function
                        >
                        > #End Region
                        >
                        > #Region "Report Export"
                        >
                        > Private Function GetExportOption s(ByVal UniqueFormat As
                        > FileNameFormats , ByVal ExportOptions As
                        > CrystalDecision s.Shared.Export Options) As
                        > CrystalDecision s.Shared.Export Options
                        >
                        > Dim myExportFile As String
                        > Dim myExportOptions As CrystalDecision s.Shared.Export Options
                        > Dim myDiskFileDesti nationOptions As
                        > CrystalDecision s.Shared.DiskFi leDestinationOp tions
                        >
                        > Try
                        >
                        > Select Case UniqueFormat
                        > Case FileNameFormats .SessionID
                        > myExportFile = Session.Session ID.ToString
                        > Case FileNameFormats .GUIDDashes
                        > myExportFile = System.Guid.New Guid.ToString(" D")
                        > Case FileNameFormats .GUIDNoDashes
                        > myExportFile = System.Guid.New Guid.ToString(" N")
                        > End Select
                        >
                        > myExportFile = System.IO.Path. Combine(GetExpo rtRoot(True),
                        > String.Format(" PDF_{0}.pdf", myExportFile))
                        > myDiskFileDesti nationOptions = New
                        > CrystalDecision s.Shared.DiskFi leDestinationOp tions
                        > myDiskFileDesti nationOptions.D iskFileName = myExportFile
                        >
                        > myExportOptions = ExportOptions
                        >
                        > With myExportOptions
                        > .DestinationOpt ions = myDiskFileDesti nationOptions
                        > .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                        > .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                        > End With
                        >
                        > Catch ex As Exception
                        >
                        > Dim exc As System.Applicat ionException
                        > exc = New System.Applicat ionException("U nable to prepare export
                        > options.", ex)
                        > Throw exc
                        >
                        > End Try
                        >
                        > Return myExportOptions
                        >
                        > End Function
                        >
                        > Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                        > String
                        >
                        > Dim strExportRoot As String
                        >
                        > If FromApplication Then
                        > Try
                        > Application.Loc k()
                        > strExportRoot = Application("Re portExportRoot" )
                        > Catch ex As Exception
                        > Dim exc As ApplicationExce ption
                        > exc = New ApplicationExce ption("Unable to lock Web
                        > Application for read.", ex)
                        > Throw exc
                        > Finally
                        > Application.UnL ock()
                        > End Try
                        > Else
                        > strExportRoot = Session("Report ExportRoot")
                        > End If
                        >
                        > Return strExportRoot
                        >
                        > End Function
                        >
                        > #End Region
                        >
                        > #Region "Navigation Implementation"
                        >
                        > Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles cmdPrint.Click
                        >
                        > Response.ClearC ontent()
                        > Response.ClearH eaders()
                        > Response.Conten tType = "applicatio n/pdf"
                        >
                        > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                        > String)
                        >
                        > Response.WriteF ile(myExportFil e)
                        > Response.Flush( )
                        > Response.Close( )
                        >
                        > System.IO.File. Delete(myExport File)
                        >
                        > End Sub
                        >
                        > Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles cmdEerste.Click
                        > crViewer.ShowFi rstPage()
                        > End Sub
                        >
                        > Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles cmdLaatste.Clic k
                        > crViewer.ShowLa stPage()
                        > End Sub
                        >
                        > Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles cmdTerug.Click
                        > crViewer.ShowPr eviousPage()
                        > End Sub
                        >
                        > Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                        > System.EventArg s) Handles cmdVerder.Click
                        > crViewer.ShowNe xtPage()
                        > End Sub
                        >
                        > Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
                        > e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                        > crViewer.Zoom(d rpZoom.Selected Item.Value)
                        > End Sub
                        >
                        > #End Region
                        >[/color]


                        Comment

                        • Alison Givens

                          #13
                          Re: How is it possible ...

                          I used the error code as suggested in the PrepareReport.
                          This is the result:

                          System.Applicat ionException: Unable to set paramatervalue. --->
                          System.Applicat ionException: Unable to read session objects. --->
                          System.InvalidC astException: Specified cast is not valid. at
                          rapportage.Prod uctiviteitsLijs t.CreateParamet erDiscreteValue (Object Value)
                          in \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 177 at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 116 --- End
                          of inner exception stack trace --- at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 121 --- End
                          of inner exception stack trace --- at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 142 at
                          rapportage.Prod uctiviteitsLijs t.Page_Init(Obj ect sender, EventArgs e) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 43
                          System.Applicat ionException: Unable to read session objects. --->
                          System.InvalidC astException: Specified cast is not valid. at
                          rapportage.Prod uctiviteitsLijs t.CreateParamet erDiscreteValue (Object Value)
                          in \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 177 at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 116 --- End
                          of inner exception stack trace --- at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 121
                          System.InvalidC astException: Specified cast is not valid. at
                          rapportage.Prod uctiviteitsLijs t.CreateParamet erDiscreteValue (Object Value)
                          in \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 177 at
                          rapportage.Prod uctiviteitsLijs t.PrepareReport (ReportDocument myReport) in
                          \\KP-COBRA\wwwroot$\ rapportage\Prod uctiviteitsLijs t.aspx.vb:line 116
                          Thread was being aborted.




















                          "AMDRIT" <amdrit@hotmail .com> wrote in message
                          news:%23rPCuSJO GHA.3984@TK2MSF TNGP14.phx.gbl. ..[color=blue]
                          >I challenge you to consider what is going on and ask why would that type of
                          >exception occur.
                          >
                          > It appears that in your Page_Unload() you are attempting to do clean up.
                          >
                          > Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                          > System.EventArg s) Handles MyBase.Unload
                          > Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                          > String)
                          > System.IO.File. Delete(myExport File)
                          > End Sub
                          >
                          > The problem is that the Session item "exportbest and" appears to be
                          > string.empty. Perhaps, the value was never properly set.
                          >
                          > The only place I see that you are setting the Session item is in
                          > page_init()
                          >
                          > Session("export bestand") = CType _
                          > (myExportOption s.DestinationOp tions,
                          > CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                          >
                          > You should test to see if DiskFileName has value, and if not, then work
                          > backwards to where it is set to determine if a value is being set there.
                          >
                          >
                          > Next, consider why the page_unload is firing without first displaying your
                          > report.
                          >
                          > try something like this in you error handling routine:
                          >
                          > Try
                          > PrepareReport(m yReport)
                          > Catch ex As Exception
                          > dim innerEx as Exception, sb as system.text.str ingbuilder
                          > sb = new system.text.str ingbuilder
                          >
                          > sb.append(ex.to string)
                          >
                          > innerEx = ex.innerexcepti on
                          >
                          > do while not innerEx is nothing
                          > sb.append(vbcrl f)
                          > sb.append(inner Ex.tostring)
                          > innerEx = innerEx.innerex ception
                          > loop
                          >
                          > response.write( sb.tostring)
                          > response.end
                          >
                          > 'exc = New ApplicationExce ption("Unable to prepare report.", ex)
                          > 'Throw exc
                          > End Try
                          >
                          >
                          > "Alison Givens" <info@cross-it.nl> wrote in message
                          > news:O0G6XiFOGH A.3576@TK2MSFTN GP15.phx.gbl...[color=green]
                          >> Yepper, the web.config is case sensitive.
                          >> That solves that problem.
                          >> Next problem:
                          >> When I give in the parameters and go to the form that holds the report I
                          >> get this:
                          >>
                          >> Value cannot be null. Parameter name: path
                          >> Description: An unhandled exception occurred during the execution of the
                          >> current web request.
                          >>
                          >> Exception Details: System.Argument NullException: Value cannot be null.
                          >> Parameter name: path
                          >>
                          >> Source Error:
                          >>
                          >>
                          >> Line 84: Dim myExportFile As String =
                          >> CType(Session.I tem("exportbest and"), String)
                          >> Line 85:
                          >> Line 86: System.IO.File. Delete(myExport File)
                          >> Line 87: End Sub
                          >> Line 88:
                          >>
                          >> I commented it, so I could at least try to go further.
                          >> Then when the form with the report loads, I get:
                          >> Unable to prepare report.
                          >>
                          >> This comes out of this error handeling:
                          >> Try
                          >> PrepareReport(m yReport)
                          >> Catch ex As Exception
                          >> Dim exc As ApplicationExce ption
                          >> exc = New ApplicationExce ption("Unable to prepare report.", ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> To be accurate I will put the entire current code here:
                          >>
                          >>
                          >> Private Enum FileNameFormats
                          >> SessionID = 0
                          >> GUIDDashes = 1
                          >> GUIDNoDashes = 2
                          >> End Enum
                          >>
                          >>
                          >>
                          >> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles MyBase.Init
                          >> 'CODEGEN: This method call is required by the Web Form Designer
                          >> 'Do not modify it using the code editor.
                          >> InitializeCompo nent()
                          >> Dim myReport As RapportAIRCOSto ringen
                          >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                          >>
                          >> Try
                          >>
                          >> Try
                          >> PrepareReport(m yReport)
                          >> Catch ex As Exception
                          >> Dim exc As System.Applicat ionException
                          >> exc = New System.Applicat ionException("U nable to prepare
                          >> report.", ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> Try
                          >> 'exporteren to pdf
                          >> myExportOptions =
                          >> GetExportOption s(FileNameForma ts.GUIDNoDashes , CType(myReport,
                          >> CrystalDecision s.CrystalReport s.Engine.Report Document).Expor tOptions)
                          >> myReport.Export ()
                          >>
                          >> Catch ex As Exception
                          >> Dim exc As ApplicationExce ption
                          >> exc = New ApplicationExce ption("Unable to export report.",
                          >> ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> crViewer.Report Source = myReport
                          >>
                          >> Session("export bestand") =
                          >> CType(myExportO ptions.Destinat ionOptions,
                          >> CrystalDecision s.Shared.DiskFi leDestinationOp tions).DiskFile Name
                          >>
                          >> Catch err As Exception
                          >> Response.Write( "<BR>")
                          >> Response.Write( err.Message.ToS tring)
                          >> End Try
                          >>
                          >>
                          >>
                          >>
                          >> End Sub
                          >>
                          >> #End Region
                          >>
                          >> #Region "Page Implementation"
                          >>
                          >> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles MyBase.Load
                          >> 'Put user code to initialize the page here
                          >> End Sub
                          >>
                          >> Private Sub Page_Unload(ByV al sender As Object, ByVal e As
                          >> System.EventArg s) Handles MyBase.Unload
                          >> 'Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                          >> String)
                          >>
                          >> 'System.IO.File .Delete(myExpor tFile)
                          >> End Sub
                          >>
                          >> #End Region
                          >>
                          >> #Region "Report Setup"
                          >>
                          >> Private Sub PrepareReport(B yVal myReport As
                          >> CrystalDecision s.CrystalReport s.Engine.Report Document)
                          >>
                          >> Dim paramFields As ParameterFields
                          >> Dim paramField As ParameterField
                          >>
                          >> Const SessionExecptio n As String = "Unable to read session
                          >> objects."
                          >>
                          >> Try
                          >>
                          >> paramFields = New ParameterFields
                          >> Try
                          >> paramField = CreateParameter ("FiliaalKeuze" )
                          >>
                          >> paramField.Curr entValues.Add(C reateParameterD iscreteValue(Ge tSessionValue(" Filiaal")))
                          >>
                          >> 'paramField.Cur rentValues.Add( CreateParameter DiscreteValue(G etSessionValue( "DiscreteValue2 ")))
                          >> Catch ex As Exception
                          >> Dim exc As ApplicationExce ption
                          >> exc = New ApplicationExce ption(SessionEx ecption, ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> myReport.SetPar ameterValue("Fi liaalKeuze", paramField)
                          >>
                          >> Try
                          >> 'Todo wrap in try
                          >> paramField = CreateParameter ("Periode")
                          >>
                          >> paramField.Curr entValues.Add(C reateParameterR angeValue(GetSe ssionValue("Beg inPeriode"),
                          >> GetSessionValue ("EindPeriode") ))
                          >> Catch ex As Exception
                          >> Dim exc As System.Applicat ionException
                          >> exc = New System.Applicat ionException(Se ssionExecption,
                          >> ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> myReport.SetPar ameterValue("Pe riode", paramField)
                          >>
                          >> Catch ex As Exception
                          >>
                          >> Dim exc As System.Applicat ionException
                          >> exc = New System.Applicat ionException("U nable to set
                          >> paramatervalue. ", ex)
                          >> Throw exc
                          >>
                          >> End Try
                          >>
                          >>
                          >> End Sub
                          >>
                          >> Private Function CreateParameter (ByVal ParameterName As String) As
                          >> ParameterField
                          >> Dim paramField As ParameterField
                          >>
                          >> paramField = New ParameterField
                          >> paramField.Para meterFieldName = ParameterName
                          >>
                          >> Return paramField
                          >>
                          >> End Function
                          >>
                          >>
                          >> Private Function GetSessionValue (ByVal KeyName As String) As Object
                          >> Try
                          >> Return Session.Item(Ke yName)
                          >> Catch ex As Exception
                          >> Dim exc As ApplicationExce ption
                          >> exc = New ApplicationExce ption(String.Fo rmat("Unable to read
                          >> value from session:{0}", KeyName), ex)
                          >> Throw exc
                          >> End Try
                          >>
                          >> End Function
                          >>
                          >>
                          >>
                          >> Private Function CreateParameter DiscreteValue(B yVal Value As Object)
                          >> As ParameterDiscre teValue
                          >>
                          >> Dim paramDiscreteVa lue As ParameterDiscre teValue
                          >> paramDiscreteVa lue = New ParameterDiscre teValue
                          >> paramDiscreteVa lue = Value
                          >>
                          >> Return paramDiscreteVa lue
                          >>
                          >> End Function
                          >>
                          >> Private Function CreateParameter RangeValue(ByVa l StartRange As Object,
                          >> ByVal EndRange As Object) As ParameterRangeV alue
                          >> Dim paramRangeValue As ParameterRangeV alue
                          >>
                          >> paramRangeValue = New ParameterRangeV alue
                          >>
                          >> paramRangeValue .StartValue = StartRange
                          >> paramRangeValue .EndValue = EndRange
                          >>
                          >> Return paramRangeValue
                          >> End Function
                          >>
                          >> #End Region
                          >>
                          >> #Region "Report Export"
                          >>
                          >> Private Function GetExportOption s(ByVal UniqueFormat As
                          >> FileNameFormats , ByVal ExportOptions As
                          >> CrystalDecision s.Shared.Export Options) As
                          >> CrystalDecision s.Shared.Export Options
                          >>
                          >> Dim myExportFile As String
                          >> Dim myExportOptions As CrystalDecision s.Shared.Export Options
                          >> Dim myDiskFileDesti nationOptions As
                          >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                          >>
                          >> Try
                          >>
                          >> Select Case UniqueFormat
                          >> Case FileNameFormats .SessionID
                          >> myExportFile = Session.Session ID.ToString
                          >> Case FileNameFormats .GUIDDashes
                          >> myExportFile = System.Guid.New Guid.ToString(" D")
                          >> Case FileNameFormats .GUIDNoDashes
                          >> myExportFile = System.Guid.New Guid.ToString(" N")
                          >> End Select
                          >>
                          >> myExportFile = System.IO.Path. Combine(GetExpo rtRoot(True),
                          >> String.Format(" PDF_{0}.pdf", myExportFile))
                          >> myDiskFileDesti nationOptions = New
                          >> CrystalDecision s.Shared.DiskFi leDestinationOp tions
                          >> myDiskFileDesti nationOptions.D iskFileName = myExportFile
                          >>
                          >> myExportOptions = ExportOptions
                          >>
                          >> With myExportOptions
                          >> .DestinationOpt ions = myDiskFileDesti nationOptions
                          >> .ExportDestinat ionType = .ExportDestinat ionType.DiskFil e
                          >> .ExportFormatTy pe = .ExportFormatTy pe.PortableDocF ormat
                          >> End With
                          >>
                          >> Catch ex As Exception
                          >>
                          >> Dim exc As System.Applicat ionException
                          >> exc = New System.Applicat ionException("U nable to prepare
                          >> export options.", ex)
                          >> Throw exc
                          >>
                          >> End Try
                          >>
                          >> Return myExportOptions
                          >>
                          >> End Function
                          >>
                          >> Private Function GetExportRoot(B yVal FromApplication As Boolean) As
                          >> String
                          >>
                          >> Dim strExportRoot As String
                          >>
                          >> If FromApplication Then
                          >> Try
                          >> Application.Loc k()
                          >> strExportRoot = Application("Re portExportRoot" )
                          >> Catch ex As Exception
                          >> Dim exc As ApplicationExce ption
                          >> exc = New ApplicationExce ption("Unable to lock Web
                          >> Application for read.", ex)
                          >> Throw exc
                          >> Finally
                          >> Application.UnL ock()
                          >> End Try
                          >> Else
                          >> strExportRoot = Session("Report ExportRoot")
                          >> End If
                          >>
                          >> Return strExportRoot
                          >>
                          >> End Function
                          >>
                          >> #End Region
                          >>
                          >> #Region "Navigation Implementation"
                          >>
                          >> Private Sub cmdPrint_Click( ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles cmdPrint.Click
                          >>
                          >> Response.ClearC ontent()
                          >> Response.ClearH eaders()
                          >> Response.Conten tType = "applicatio n/pdf"
                          >>
                          >> Dim myExportFile As String = CType(Session.I tem("exportbest and"),
                          >> String)
                          >>
                          >> Response.WriteF ile(myExportFil e)
                          >> Response.Flush( )
                          >> Response.Close( )
                          >>
                          >> System.IO.File. Delete(myExport File)
                          >>
                          >> End Sub
                          >>
                          >> Private Sub cmdEerste_Click (ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles cmdEerste.Click
                          >> crViewer.ShowFi rstPage()
                          >> End Sub
                          >>
                          >> Private Sub cmdLaatste_Clic k(ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles cmdLaatste.Clic k
                          >> crViewer.ShowLa stPage()
                          >> End Sub
                          >>
                          >> Private Sub cmdTerug_Click( ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles cmdTerug.Click
                          >> crViewer.ShowPr eviousPage()
                          >> End Sub
                          >>
                          >> Private Sub cmdVerder_Click (ByVal sender As System.Object, ByVal e As
                          >> System.EventArg s) Handles cmdVerder.Click
                          >> crViewer.ShowNe xtPage()
                          >> End Sub
                          >>
                          >> Private Sub drpZoom_Selecte dIndexChanged(B yVal sender As Object, ByVal
                          >> e As System.EventArg s) Handles drpZoom.Selecte dIndexChanged
                          >> crViewer.Zoom(d rpZoom.Selected Item.Value)
                          >> End Sub
                          >>
                          >> #End Region
                          >>[/color]
                          >
                          >[/color]


                          Comment

                          • AMDRIT

                            #14
                            Re: How is it possible ...

                            Hello Alison,

                            Take a look at what the exception output is telling you.

                            System.InvalidC astException: Specified cast is not valid. at
                            rapportage.Prod uctiviteitsLijs t.CreateParamet erDiscreteValue (Object Value)

                            If we take a look at the mechanics of that function, you will see:

                            -->Define variable <-- set's the contract of the object we want, as long as
                            we hold a reference to the appropriate library we should be fine with this
                            line of code

                            -->Create variable <-- just like frakenstien, bring it to life. It is
                            possible to screw up here, especially if the New() is expecting input.

                            -->Assign some value to the Value property <-- Here we can screw up by
                            assigning a value type to the property that is not convertible to the
                            desired type. Or, we could simply neglect to specify which property we wish
                            to modify, in which case we would be trying to change the contract of the
                            variable.

                            If you take a closer inspection, you should not that the code does not
                            attempt to assign a value to the Value() property, rather it attempts to
                            assign the value to the object itself. So in effect, we made space for a
                            ParameterDiscre teValue and attempted to change it into a string.

                            If you turn on Option Strict (easiest way is to type Option Strict On, at
                            the top of your code pane; before any other text), issues like this will be
                            revealed before you compile. The downside to doing this is that you will
                            loose all of your implicit type conversions that VB does for you. That
                            means:

                            dim objString as string
                            objString = 6
                            (This will produce compiler error, since VB will not try to convert a number
                            'Integer' into a string.)

                            Becomes

                            dim objString as string
                            objString = 6.ToString
                            (Please note that all objects have a ToString method, however; not all will
                            provide the String like number types will. Example: a datatable.tostr ing
                            will return something like "system.data.da tatable" rather than the data
                            inside the object.)

                            or

                            dim objString as string
                            objString = ctype(6,string)
                            (Please note that there are two generic type converters, CType and
                            DirectCast, look them up as homework, You should get into practice of using
                            them as a matter of process.)

                            If you are using C#, instead of ctype you can create the conversion as such:

                            String objString=Strin g.Empty;
                            objString = (string)6;
                            (I don't know what that is called, I just think it is cool. Eitherway, it
                            solves for Option Strict issues.)


                            It appears that your problem is here

                            Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                            ParameterDiscre teValue

                            Dim paramDiscreteVa lue As ParameterDiscre teValue
                            paramDiscreteVa lue = New ParameterDiscre teValue
                            paramDiscreteVa lue = Value

                            Return paramDiscreteVa lue

                            End Function

                            Should be

                            Private Function CreateParameter DiscreteValue(B yVal Value As Object) As
                            ParameterDiscre teValue

                            Dim paramDiscreteVa lue As ParameterDiscre teValue
                            paramDiscreteVa lue = New ParameterDiscre teValue

                            '--==>Assign Value to the value property, not the object.'<==--
                            paramDiscreteVa lue.Value = Value

                            Return paramDiscreteVa lue


                            End Function


                            Let me know if any of this is not clear.


                            Comment

                            Working...