Vb.Net-Informations.com



     VB.NET Crystal Reports Tutorials

 * VB.NET Crystal Reports for Beginners


VB.NET Crystal Reports for Beginners

Start your first VB.NET Crystal Reports .

All Crystal Reports programming samples in this tutorials is based on the following database (crystaldb) . Please take a look at the database structure before you start this tutorial - Click here to see Database Structure .

Open Visual Studio .NET and select a new Visual Basic .NET Project.

simple_vb.net_crystal_report_1.GIF

Create a new Crystal Reports for Product table from the above database crystalDB. The Product Table has three fields (Product_id,Product_name,Product_price) and we are showing the whole table data in the Crystal Reports.

From main menu in Visual Studio select PROJECT-->Add New Item . Then Add New Item dialogue will appear and select Crystal Reports from the dialogue box.

simple_vb.net_crystal_report_2.GIF

Select Report type from Crystal Reports gallery.

simple_vb.net_crystal_report_3.GIF

Accept the default settings and click OK.

Next step is to select the appropriate connection to your database. Here we are going to select OLEDB connection for SQL Server

Select OLE DB (ADO) from Create New Connection .

simple_vb.net_crystal_report_4.GIF

Select Microsoft OLE DB Provider for SQL Server .

simple_vb.net_crystal_report_5.GIF

Next screen is the SQL Server authentication screen . Select your Sql Server name , enter userid , password and select your Database Name . Click next , Then the screen shows OLE DB Property values , leave it as it is , and click finish.

Then you will get your Server name under OLEDB Connection from there select database name (Crystaldb) and click the tables , then you can see all your tables from your database.

From the tables list select Product table to the right side list .

simple_vb.net_crystal_report_6.GIF

Click Next Button

Select all fields from Product table to the right side list .

simple_vb.net_crystal_report_7.GIF

Click Finish Button. Then you can see the Crystal Reports designer window . You can arrange the design according your requirements. Your screen look like the following picture.

simple_vb.net_crystal_report_8.GIF

Now the designing part is over and the next step is to call the created Crystal Reports in VB.NET through Crystal Reports Viewer control .

Select the default form (Form1.vb) you created in VB.NET and drag a button and CrystalReportViewer control to your form.

simple_vb.net_crystal_report_9.GIF

Select Form's source code view and put the code on top

Imports CrystalDecisions.CrystalReports.Engine

Put the following source code in the button click event


         VB.NET Source Code Download           Print Source Code
         VB.NET Crystal Reports for Beginners - Download
        
Vb.Net Help

Imports CrystalDecisions.CrystalReports.Engine
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, 
	ByVal e As System.EventArgs) Handles Button1.Click
        Dim cryRpt As New ReportDocument
        cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    End Sub
End Class

NOTES:

cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")

The Crystal Reports is in your project location, there you can see CrystalReport1.rpt . So give the full path name of report here.

After you run the source code you will get the report like this.

simple_vb.net_crystal_report_10.GIF


Hope this tutorial help you to create your first Crystal Reports.

VB.NET Crystal Reports Related Contents
*     Sample Database and tables for Crystal Reports tutorials
*     VB.NET Crystal Reports from multiple tables
*     VB.NET Crystal Reports String parameter
*     VB.NET Crystal Reports Integer parameter
*     VB.NET Crystal Reports Date parameter
*     VB.NET Crystal Report Load Dynamically
*     VB.NET Crystal Reports Formula Fields
*     VB.NET Crystal Reports Summary Fields
*     VB.NET Crystal Reports Export to PDF
*     VB.NET Crystal Reports Export to Excel
*     Email a Crystal Reports from VB.NET
*     Crystal Reports Without Database
*     Crystal Report from SQL Query String
*     Dynamic Crystal Reports from SQL Query String
*     Crystal Reports from XML File
*     Create a Subreport in Crystal Reports
*     Create a Subreport in Crystal Reports with Link
*     How to deploy Crystal Reports on Clinet Machine
*     How to create Crystal Reports installer using Merge Modules

VB.Net Related Topics
*     Microsoft .Net Framework Tutorials
*     VB.NET Language Basics Tutorials
*     VB.NET Program Flow Control Tutorials
*     VB.NET Collections Tutorials
*     VB.NET String Tutorials
*     VB.NET Files Tutorials
*     VB.NET Excel 2007 Tutorials
*     VB.NET Crystal Reports Tutorials
*     VB.NET Communications Tutorial
*     VB.NET ADO.NET Tutorial with source code
*     ADO.NET Data Providers help and Tutorial
*     VB.NET ADO.NET Dataset Tutorial
*     ADO.NET DataAdapter and Dataset
*     VB.NET ADO.NET DataView Tutorial
*     VB.NET Remoting Tutorial
*     VB.NET XML Tutorial
Search here for more Vb.Net Source Code :


   Categories

    HOME
    VB.NET
    CSHARP

 
 
   













  |  Home   |  SiteMap   |  About   |
net-informations.com (C) 2010 All Rights Reserved