Crystal Report Formulation field, custom report

Source: Internet
Author: User

Http://www.cnblogs.com/babyt/archive/2008/01/03/1024941.html

In the Crystal report in the implementation of arbitrary select the specified field display in a friend message said there is no C # version, recently have time to rewrite a bit.
One is the use of the VS2005 c#2.0 + Crystal 2008, in addition to the template to implement the way also changed.

Here is a step-by-step, the implementation of the template and XSD files and MDB files, from the Crystal Report in the implementation of arbitrary selection of the specified field to display the article download
But the template is here to illustrate that the header section of the template in this article does not use parameter fields, but instead uses a formula field.
As shown in the following figure



The final effect is


Each control uses a default name, and the main event is click

CR2008 automatically add the following code 1 using Crystaldecisions.shared;
2 using CrystalDecisions.CrystalReports.Engine;
3 using CrystalDecisions.Windows.Forms;

Click event code: 1 private void Button1_Click (object sender, EventArgs e)
2 {
3
4
5 String cnstr = "";
6//Keep the field string
7 String fldstr = "";
8//Keep an array of field names
9 string[] Fldarr=new string[6];
Ten int i = 0;
int j = 0;
12
13
14
/---------------------------------------------------------------------
16//Get the selected field and process it
if (checkbox1.checked = = True)
Fldstr = Fldstr + "," + checkbox1.text;
if (checkbox2.checked = = True)
Fldstr = Fldstr + "," + checkbox2.text;
An if (checkbox3.checked = = True)
Fldstr = Fldstr + "," + checkbox3.text;
if (checkbox4.checked = = True)
Fldstr = Fldstr + "," + checkbox4.text;
if (checkbox5.checked = = True)
Fldstr = Fldstr + "," + checkbox5.text;
/if (checkbox6.checked = = True)
Fldstr = Fldstr + "," + checkbox6.text;
29
if (Fldstr = "") {
MessageBox.Show ("Please select the fields to display");
return;
33}
34
The IF (FLDSTR). Substring (0, 1) = = ",")
Fldstr = Fldstr. Substring (1, Fldstr. LENGTH-1);
37
38

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.