<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Set a Range Parameter Value to a Crystal Report</Title>
            <Author>Business Objects</Author>
            <Description>Sets a range parameter value to a Crystal Report.</Description>
            <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
            <Keywords>
            </Keywords>
            <Shortcut>crSetRangeParam</Shortcut>
            <Location>Crystal Reports</Location>
        </Header>
        <Snippet>
            <References>
                <Reference>
                    <Assembly>CrystalDecisions.CrystalReports.Engine.dll</Assembly>
                    <URL />
                </Reference>
                <Reference>
                    <Assembly>CrystalDecisions.Shared.dll</Assembly>
                    <URL />
                </Reference>
            </References>
            <Imports>
                <Import>
                    <Namespace>System</Namespace>
                </Import>
                <Import>
                    <Namespace>CrystalDecisions.CrystalReports.Engine</Namespace>
                </Import>
                <Import>
                    <Namespace>CrystalDecisions.Shared</Namespace>
                </Import>
            </Imports>
            <Declarations>
                <Literal>
                    <ID>ReportName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this string with the name of the report file you want to set the parameter value to.</ToolTip>
                    <Default>"C:\My Crystal Reports\Report Name.rpt"</Default>
                </Literal>
                <Literal>
                    <ID>ParameterName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this value with the parameter name that the report will be using. </ToolTip>
                    <Default>"Parameter1"</Default>
                </Literal>
                <Literal>
                    <ID>SubreportName</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this value with the subreport name that the report will be using. </ToolTip>
                    <Default>subreportName.rpt</Default>
                </Literal>
                <Literal>
                    <ID>StartValue</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this StartValue of the range Parameter field with the new value that the report will be using. </ToolTip>
                    <Default>0.0</Default>
                </Literal>
                <Literal>
                    <ID>EndValue</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this EndValue of the range Parameter field with the new value that the report will be using. </ToolTip>
                    <Default>100.0</Default>
                </Literal>
                <Literal>
                    <ID>LowerBoundType</ID>
                    <Type>RangeBoundType</Type>
                    <ToolTip>Replace this LowerBoundType of the range Parameter field with the new RangeBoundType type value that is used in the report. </ToolTip>
                    <Default>RangeBoundType.BoundInclusive</Default>
                </Literal>
                <Literal>
                    <ID>UpperBoundType</ID>
                    <Type>RangeBoundType</Type>
                    <ToolTip>Replace this UpperBoundType of the range Parameter field with the new RangeBoundType type value that the report will be using. </ToolTip>
                    <Default>RangeBoundType.BoundInclusive</Default>
                </Literal>
            </Declarations>
            <Code Language="VB" Kind="method body"><![CDATA[Dim report as new ReportDocument()
                report.Load($ReportName$)
                
                Dim parameterField As ParameterField
                parameterField = report.ParameterFields($ParameterName$)

                ' If the parameter is from a subreport, specify the subreport name
                ' parameterField = report.ParameterFields($ParameterName$, $SubreportName$)

                ' Add all parameters value here
                ParameterField.CurrentValues.AddRange($StartValue$, $EndValue$, $LowerBoundType$, $UpperBoundType$)
                ]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>