Adding Controls to Use in the Selection Formula
In this section, you add controls to dynamically change the values that are used in the selection formula. For the Last Year's Sales field, you add a textbox to specify the minimum value of sales to be displayed in the Crystal report. For the Customer Name field, you add a DropDownList and TextBox control to specify what customer names to display.
- Open the Web or Windows Form.
- From the View menu, click Designer.
- If you are developing a Web Site, do the following:
- Click the CrystalReportViewer control to select it.
2. Press the LEFT ARROW on your keyboard so that a flashing cursor appears, and then press ENTER three times.
The CrystalReportViewer control drops by three lines.
- If you are developing a Windows project, do the following:
- Click the CrystalReportViewer control to select it.
- From the Properties window, set Dock to "Bottom".
- Resize the CrystalReportViewer control, so that approximately three lines appear above it.
- From the Properties window, set Anchor to "Top, Bottom, Left, Right".
- If you are developing a Web Site, on the first line type, Enter the minimum value for last year's sales: $.
- If you are developing a Windows project, do the following:
- From the Toolbox, drag a Label control to the top of the form.
- From the Properties window, set the Text property to Enter the minimum value for last year's sales: $.
- From the Toolbox, drag a TextBox control to the right of the text.
- Select the TextBox control, and then from the Properties window, do the following:
- Set the ID (or Name) to lastYearsSales.
- Set the Text to 11000.00.
- If you are developing a Web Site, on the second line, type Display the customer names.
- If you are developing a Windows project, do the following:
- From the Toolbox, drag a Label control to the second line of the form.
- From the Properties window, set the Text property to "Display the customer names".
- From the Toolbox, drag a DropDownList ( ComboBox in a Windows project) to the right of the text.
- Select the DropDownList ( ComboBox) control, and then from the Properties window, set the ID (or Name) to "selectOperatorList".
- From the Toolbox, drag a TextBox control to the right of the DropDownList control.
- Select the TextBox control, and then from the Properties window, do the following:
- Set the ID (or Name) to customerName.
- Set the Text to A.
- From the Toolbox, drag a Button control to the third line of the form, and above the CrystalReportViewer control.
- Select the Button control, and then from the Properties window, do the following:
- Set the ID (or Name) to redisplay.
- Set the Text to Redisplay Report.