Popular Posts

Dec 13, 2010

Crystral Report

To making Crystal Report i continue from my previous post. So you have to follow from my previous post.


Step1: Add a button on the windows form.We add the button in FirstUI.cs.Then rename the button as crystalButton.
Step2: Add a new Windows Form and named it CrystalUI.
Step3: Add CrystalReportViewer from Toolbox to the form CrystalUI.
Step4: Rename the CrystalReportViewer to studentCrystalReportViewer.
Step5:Add new CrystalReport and named it StudentCrystalReport.



Step6: Select As a blank Report and then click ok.
Step7: Add these code to CrystalUI.cs
StudentBLL studentBLLObj = null;
        public CrystalUI()
        {
            studentBLLObj = new StudentBLL();
            InitializeComponent();
            StudentCrystalReport reportObj = new StudentCrystalReport();
            reportObj.SetDataSource(studentBLLObj.GetStudentInfo());
            studentCrystalReportViewer.ReportSource = reportObj;

        }

Step8:Double click on StudentCrystalReport.rpt



Step9:Select database field and then right click on database expert.


Step10: After select the field from the database experts.


Step11: Double click on the button crystalButton which is in the FirstUI.cs

Then write these code so the when you click on the button the crystal report window can open….


        private void crystalButton_Click(object sender, EventArgs e)
        {
            CrystalUI crystalObj = new CrystalUI();
            crystalObj.Show();
        }

Step12:Run the project and then click on the Make Report button.You will see the crystal Report like this.




No comments:

Post a Comment