Share via


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.

  1. Open the Web or Windows Form.
  2. From the View menu, click Designer.
  3. If you are developing a Web Site, do the following:
  4. 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.
  1. If you are developing a Windows project, do the following:
    1. Click the CrystalReportViewer control to select it.
    2. From the Properties window, set Dock to "Bottom".
    3. Resize the CrystalReportViewer control, so that approximately three lines appear above it.
    4. From the Properties window, set Anchor to "Top, Bottom, Left, Right".
  2. If you are developing a Web Site, on the first line type, Enter the minimum value for last year's sales: $.
  3. If you are developing a Windows project, do the following:
    1. From the Toolbox, drag a Label control to the top of the form.
    2. From the Properties window, set the Text property to Enter the minimum value for last year's sales: $.
  4. From the Toolbox, drag a TextBox control to the right of the text.
  5. Select the TextBox control, and then from the Properties window, do the following:
  6. Set the ID (or Name) to lastYearsSales.
  7. Set the Text to 11000.00.
  8. If you are developing a Web Site, on the second line, type Display the customer names.
  9. If you are developing a Windows project, do the following:
  10. From the Toolbox, drag a Label control to the second line of the form.
  11. From the Properties window, set the Text property to "Display the customer names".
  12. From the Toolbox, drag a DropDownList ( ComboBox in a Windows project) to the right of the text.
  13. Select the DropDownList ( ComboBox) control, and then from the Properties window, set the ID (or Name) to "selectOperatorList".
  14. From the Toolbox, drag a TextBox control to the right of the DropDownList control.
  15. Select the TextBox control, and then from the Properties window, do the following:
    1. Set the ID (or Name) to customerName.
    2. Set the Text to A.
  16. From the Toolbox, drag a Button control to the third line of the form, and above the CrystalReportViewer control.
  17. Select the Button control, and then from the Properties window, do the following:
  18. Set the ID (or Name) to redisplay.
  19. Set the Text to Redisplay Report.