<?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 Discrete Parameter Value to a Crystal Report</Title>
            <Author>Business Objects</Author>
            <Description>Sets a discrete parameter value.</Description>
            <HelpUrl>http://www.businessobjects.com/products/dev_zone/net/default.asp</HelpUrl>
            <Keywords>
            </Keywords>
            <Shortcut>crSetDiscreteParam</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>DiscreteValue</ID>
                    <Type>String</Type>
                    <ToolTip>Replace this value with new one according to parameter value kind that the report will be using. </ToolTip>
                    <Default>100.0</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>
            </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.AddValue($DiscreteValue$)
                ]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>