By: Issac Viewed: 154395 times Printer Friendly Format
Crystal Report is an application which can generate various reports from different data sources, we can create reports, print and preview those report using it, It is compatible with almost a developing platforms and databases, In this article you can find useful resources for generating reports from VB.NET with Crystal Report.
We can now see how to create a sample Database and Tables and data. First we have to create a database. Give the database name as "crystaldb"
Create a DataBase "crystaldb"
In the crystaldb database, let us create three tables OrderMaster, OrderDetails, Product.
Now that you have a database you can start your first VB.NET Crystal Reports.
All Crystal Reports programming samples in these tutorials are based
upon the following database (crystaldb, the one we created through the previous
Open Visual Studio .NET and select a new Visual
Basic .NET Project.
Create a new Crystal Report for Product table from
the above database crystalDB. The Product Table has three fields (Product_id,
Product_name, and Product_price).
From the 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.
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
Select OLE DB (
Select Microsoft OLE DB Provider for SQL
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
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.
Click Next Button
Select all fields from Product table to the right
Click Finish Button. Then you can see the Crystal
Reports designer window. You can arrange the design according your requirements.
Your screen looks like the following picture.
Now the designing part is over and the next step
is to call the created Crystal Reports in VB.NET through
Select the default form (Form1.vb) you created in VB.NET and drag a button
and CrystalReportViewer control to your form.
Select Form's source code view and put the code on
Put the following source code in the button click
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
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.
Hope this article helps you to create your first Crystal Reports.
Most Viewed Articles (in VB.net )
Latest Articles (in VB.net)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Subscribe to Tutorials
3. Hey is there any way to export datagrid to crystal
View Tutorial By: Anu at 2009-05-08 13:11:48
4. can i have sample of java programming that has dat
View Tutorial By: piolo at 2009-05-31 18:53:25
5. the above is perfect, but when i hit the export bu
View Tutorial By: CH at 2009-06-02 03:01:34
11. hay is there any way to perform operation or calcu
View Tutorial By: neha at 2009-11-20 08:29:45
12. hay is there any way to perform operation or calcu
View Tutorial By: neha at 2009-11-20 08:30:10
13. hay is there any way to perform operation or calcu
View Tutorial By: neha at 2009-11-20 08:30:48
17. hi this is very helpful........thank you very much
View Tutorial By: sumalatha at 2010-06-07 01:53:33
18. hi this is very helpful........thank you very much
View Tutorial By: sumalatha at 2010-06-07 02:16:37
19. My crystal report keeps asking for a login passwor
View Tutorial By: Larry at 2010-07-30 11:58:38
25. can you clearly reveal how to create crystal repor
View Tutorial By: halim at 2011-07-02 00:28:48
30. Microsoft VB.net 2008 not showing Crystal Report V
View Tutorial By: Ali at 2011-11-30 03:21:00
32. dear i have different files of ms access 2010 like
View Tutorial By: neeo at 2012-01-16 07:02:20
33. hey, what the hell are you doing.. this kind of pl
View Tutorial By: Ameen at 2012-02-02 08:08:42
36. hey i want to retrieve data from database table an
View Tutorial By: Mohammed Mohiuddin at 2012-02-25 09:11:11
40. Fantastic Post, can u pls tell me how can i pass q
View Tutorial By: Kunal at 2012-08-07 07:02:41
42. is there any way to generate report without seagat
View Tutorial By: Roshni at 2012-10-01 09:32:41
46. Your Crystal report viewer showing all the records
View Tutorial By: Neel at 2013-06-09 15:02:15
48. Very good. but why i can search data then report v
View Tutorial By: ARMAN AHMED at 2015-04-27 13:18:04
49. My children were needing Leave of abscence portlan
View Tutorial By: Johnny Krauss at 2016-09-12 07:51:10
52. I see you don't monetize your page, don't waste yo
View Tutorial By: 86Adelaide at 2017-08-17 03:02:51