tailieunhanh - Crystal Reports For Visual Studio 2005 phần 2

Trong phần này, bạn cư trú trong điều khiển DropDownList với những hoạt động so sánh. Bạn tạo ra một enum có chứa các toán tử so sánh. Việc kiểm soát DropDownList lựa chọn xem bạn muốn hiển thị tên khách hàng bằng, ít hơn, lớn hơn, nhỏ hơn hoặc bằng, lớn hơn hoặc bằng hoặc không bằng văn bản mà bạn đã nhập vào điều khiển TextBox. | Walkthroughs Using a DropDownList Control to Modify the Selection Formula In this section you populate the DropDownList control with comparison operators. You create an enum that contains the comparison operators. The DropDownList control selects whether you want to display customer names that are equal to less than greater than less than or equal to greater than or equal to or not equal to the text that you have entered into the TextBox control. In the redisplay_Click event method you modify the string that is currently assigned to the SelectionFormula property of the CrystalReportViewer control. To create the CeComparisonOperator enum 1. In Solution Explorer right-click the project name that is in bold type point to Add and then click Add New Item. 2. In the Add New Item dialog box select Class from the Templates view. 3. In the Name field type CeComparisonOperator and then click Add. Note In Visual Studio 2005 you may be asked to place this class in a Code directory. Click the Yes button. 4. In the class signature change the word class to enum to convert the class to an enumeration. In a C Windows project for Visual Studio 2005 you also must change the namespace to the name of your project. Note In Visual Basic remember to change both the opening and the closing signatures of the class to enum. 5. Because enums do not have constructors delete the default constructor method that is provided in the C version of the code. 6. Inside the enum enter the values Visual Basic EqualTo LessThan GreaterThan LessThan or EqualTo GreaterThan or EqualTo Not EqualTo end C EqualTo LessThan GreaterThan LessThan or EqualTo GreaterThan or EqualTo Copyright 2004 Business Objects Page 60 Walkthroughs Not EqualTo end The following procedures explain how to bind the CeComparisonOperator enum to the DropDownList control for a Web Site or for a Windows project. Complete the instructions in one of the step procedures below. To populate the DropDownList control from the CeComparisonOperator