C#
  Home arrow C# arrow Page 2 - 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 
Mobile Linux 
App Generation ROI 
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 / 64
    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 2: Creating a Custom Stock Market Information


    (Page 2 of 5 )

    Scenario

    In this exercise, you will create a custom class to hold stock market information. This class will be used to populate an Object Collection.

            Tasks            Detailed Steps

    1. Adding a class to your Website.

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

        The Add New Item dialog box appears.
      2. In the Visual Studio Installed Templates field, select Class 
      3. In the Name field, type Stock, and then click Add.
      4. In the dialog box that appears, click Yes.

        In Visual Studio 2005, all classes must be placed inside of an App Code folder if they are to be generally consumable. When you click the Add button, an alert box will ask you if you would like to place your class inside of this App_Code folder.

      5. The Stock class must be set to public scope to be accessed when you create the report. Verify that the class you have created is public. If not, add the public modifier to the class signature to expose the class to the embedded Crystal Report Designer.

        public class Stock
        {
           public Stock()
           {
           }
        }

      6. Within the class, add three private fields.

        private string _symbol;
        private double _price;
        private int _volume;

        Next, you will add three public read/write properties to encapsulate the three private fields. 
      7. Create a new property named Symbol.

        public string Symbol
        {
            get
            {
                  return _symbol;
            }
            set
           {
                  _symbol = value;
           }
        }

      8. Create a new property named Price.

        public double Price
        {
          get
          {
             return _price;
          }
          set
          {
             _price = value;
          }
        }

      9. Create a new property named Volume.

        public int Volume
        {
          get
          {
               return _volume;
          }
          set
          {
               _volume = value;
          }
        }


      10. Finally, create a new constructor that takes the three public properties as arguments.

        public Stock (String symbol, int volume, double price)
        {
           _symbol = symbol;
           _volume = volume;
           _price = price;
        }

      11. From the Build menu, click Build Website.

        If you have any build errors, fix them now.
      12. You are now ready to access this object from the embedded Crystal Report Designer.

    Exercise 3: Creating a Crystal Report

    Scenario

    In this exercise, you create a new Crystal report in the embedded Crystal Report Designer and then bind this report to the Stock object.

            Tasks              Detailed Steps

    1. Create a Crystal Report.

      1. Right-click the web site name and click Add New Item.
      2. In the Add New Item dialog box, select Crystal Report.
      3. In the Name field, enter StockObjects.rpt, and then click Add
      4. In the Crystal Reports Gallery dialog box, click OK.
      5. In the Standard Report Creation Wizard dialog box, expand Project Data and the sub node .NET Objects.

        A list of classes within the project appears.
      6. Expand the Stock class to view a selectable sub node.
      7. Click the right-arrow > to move the Stock class sub node to the Selected Tables panel.
      8. Click Next.
      9. Expand Stock and click the >> to move all columns to the Fields to Display panel.
      10. Click Next.
      11. Select Symbol and click the right-arrow > to move it into the Group By panel.
      12. Click Finish.

    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.

    More C# Articles
    More By MSDN Virtual Labs


       · 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...
       · This is the best ever tutorial article I ever seen on the net
       · Hi,I think you have put following methods in wrong...
     

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - 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...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT