C#
  Home arrow C# arrow Page 5 - Crystal Reports for Visual Studio 2005 in ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Crystal Reports for Visual Studio 2005 in CSharp
By: MSDN Virtual Labs
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 58
    2006-02-02

    Table of Contents:
  • Crystal Reports for Visual Studio 2005 in CSharp
  • Exercise 2: Creating a Custom Stock Market Information
  • Exercise 4: Bind your Crystal Report to the Crystal Report Viewer
  • Exercise 5: Adding Data Dynamically to the Stock Report
  • Exercise 6: Adding Charts and Summary Information to the Report

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Crystal Reports for Visual Studio 2005 in CSharp - Exercise 6: Adding Charts and Summary Information to the Report


    (Page 5 of 5 )

    Scenario

    At this point, you have a fully functional web site that will display a Crystal report based off of an Object Collection. The site displays information that is programmatically entered into an Object Collection, as well as information that is added dynamically at run time.

    In this exercise, you will add two charts, a calculated field, and summary information.

            Tasks            Detailed Steps   

    1. Adding a simple chart to the report.

      1. From the solution explorer, open StockObjects.rpt
      2. From the Crystal Reports menu, select Insert, and click Chart.
      3. In the Chart Expert dialog box, select a Pie chart.
      4. Select the Data tab.
      5. Select Stock.Symbol and click the top most Right Arrow to move the Stock.Symbol field to the On Change Of field.
      6. Select Stock.Volume and click the bottom most Right Arrow to move the Stock.Volume field to the Show Value(s) field. 
      7. Click OK.
      8. A new Report Header section is created, and a chart object is added to this section. 
      9. From the Debug menu, click Start Debugging.

        If no build errors appear, the Default.aspx page loads into your browser.

      10. Close the Internet Explorer window.
    2. Adding a chart based on a formula field. In this section, you will create a chart that reports off of aggregate information. You will first create a formula to calculate the worth of a particular holding, and then create a pie chart that displays the proportional worth of all of your holdings. 

      1. From the Crystal Reports menu, select Report, and click Formula Workshop.
      2. In the Formula Workshop dialog, select Formula Fields
      3. Click the New button to create a new formula.
      4. In the Formula Name dialog, enter worth. 
      5. Click Use Editor.
      6. Add code to multiply the value of the price field by the value of the volume field.

        {Stock.Volume}*{Stock.Price}
      7. Click Save and close.
      8. From the Crystal Reports menu, select Insert, and click Chart.
      9. In the Chart Expert dialog box, select a Pie chart.
      10. Click the Data tab.
      11. Select Stock.Symbol and click the top most Right Arrow to move the Stock.Symbol field to the On Change Of field.
      12. Select Worth and click the bottom most Right Arrow to move the Worth formula to the Show Value(s) field.
      13. Click the Text tab.
      14. Beside Title, clear the Auto-text checkbox. 
      15. Enter Worth / Symbol in the Title field.
      16. Click OK
      17. A new Report Header section is created, and a Chart Object is added to this

        section

        To re-position the objects within a Crystal report, drag them with your mouse and place them where you like. You can use the Main Report Preview button at the bottom of the form to display a preview of your report.

    3. Adding Formula and Summary fields to your report. In this section, you add a formula field to your report, and a summary field that will calculate the total value of your portfolio.

        1. Expand the Formula Fields node of the Field Explorer.

        2. Drag the worth formula onto your report. Position this field within the Details section of your report.

           
          If the Field Explorer is not visible, select Document Outline from the View menu. This field will display the worth of each row. Use a summary field to display the total worth of your portfolio.

        3.  From the Crystal Reports menu, select Insert, and click Summary.

          The Insert Summary dialog box appears.

        4.  Select the Worth formula from the Choose the Field to Summarize field.

        5. Select Sum from the Calculate this Summary field. 

        6. Select Grand Total from the Summary Location field.

        7. Click OK.

          A summary field is added to the report. 

        8.  From the Debug menu, click Start Debugging.

        9. If no build errors appear, the Default.aspx page loads into your browser. 

        10. Close the Internet Explorer window.

    4. Adding a pre-existing report. In this section, you will set your Web Application to use an existing report located on your file system.

        1. Right click on StockObjects.rpt in the Solution Explorer

        2. Click Delete

        3. Click OK in the dialog that pops up. 

        4. In Solution Explorer, right-click the web site name that is in bold type and then click Add Existing Item.

        5. In the Add Existing Item dialog, navigate to C:\Microsoft Hands-On-Lab\HOL-ILL05\Source\ Excercises and select the StockObjects.rpt file. 

        6. Click Add

        7. From the Debug menu, click Start Debugging

        8. If no build errors appear, the Default.aspx page loads into your browser and displays your new report.

        9. Close the Internet Explorer window.

    Take Microsoft software for a test drive. With MSDN Virtual Labs, you get full access to all available Microsoft products through 90-minute modules, each with its own downloadable manual. Try this lab out now.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · We hope you found this article by MSDN Virtual Labs to be enjoyable and educational....
       · This exercise has been followed to the letter and cannot run. It opens with a...
       · hiim very new to asp.net here ..i encountered this msg, No overload for method...
       · I have the same problem too. Answer?
       · I also have this problem. It seems to me that if the report use dataset and/or .net...
       · CAN YOU POST THE STEP BY STEP EXAM FOR WINFORM APPLICATION ? THANK YOU VERY...
       · I encountered the same problem .. pls let me know how to disable the login prompt...
     

    C# ARTICLES

    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...
    - Color Transformation in C# GDI+ Programming
    - Exceptions in C#
    - Overriding versus Overloading
    - Value Types and Reference Types
    - Defining Member and Type Visibility
    - Managing Files in C#
    - Working with Windows Registry in C#
    - Lossless Image Resizing in C#
    - Lossless Image Converting in C#
    - Creating an RSS Feed with ASP.Net Written in...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway