Your first VB.NET Crystal Reports - A step by step guide
By: Issac
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.
OrderMaster
1. OrderMaster_id
2. OrderMaster_date
3. OrderMaster_customer
4. OrderMaster_createduser
OrderDetails
1. OrderDetails_id
2. OrderDetails_masterid
3. OrderDetails_productid
4. OrderDetails_qty
Product
1. Product_id
2. Product_name
3. Product_price
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
article).
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
Server
Select OLE DB (
Select Microsoft OLE DB Provider for SQL
Server.
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.
Click Next Button
Select all fields from Product table to the right
side list.
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
top
Imports CrystalDecisions.CrystalReports.Engine
Put the following source code in the button click
event
Imports CrystalDecisions.CrystalReports.Engine
NOTES:
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
cryRpt.Load ("PUT
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.
Archived Comments
1. I see you don't monetize your page, don't waste your traffic, you can earn extra cash every month be
View Tutorial By: 86Adelaide at 2017-08-17 03:02:51
2. Billyweimb
View Tutorial By: Billyweimb at 2017-07-21 15:05:44
3. KrolKax
View Tutorial By: KrolKax at 2017-04-28 06:11:45
4. My children were needing Leave of abscence portland state pdx form recently and were told about a gr
View Tutorial By: Johnny Krauss at 2016-09-12 07:51:10
5. Very good. but why i can search data then report view.
View Tutorial By: ARMAN AHMED at 2015-04-27 13:18:04
6. Hi,
how can make a report to display one record after the other...e.g if its about students r
View Tutorial By: david at 2013-08-30 16:09:23
7. Your Crystal report viewer showing all the records that is in Database together. But will you please
View Tutorial By: Neel at 2013-06-09 15:02:15
8. The tutorial is very usefull, i am happy now
View Tutorial By: Haneefa at 2013-03-30 06:31:47
9. i want to know the step by step process of vb.net reporting in 2010
View Tutorial By: moumita das at 2012-12-01 12:28:35
10. sap crystal active-x design
failed to open a connection
connection open.sqlsever does
View Tutorial By: Mubarak at 2012-11-11 17:16:54
11. is there any way to generate report without seagate crystal software
View Tutorial By: Roshni at 2012-10-01 09:32:41
12. how to set the report for particularn form feilds in vb.net 2008...?
not for database....
View Tutorial By: mathivanan at 2012-09-21 00:05:07
13. Fantastic Post, can u pls tell me how can i pass query to this report?
I want to display resu
View Tutorial By: Kunal at 2012-08-07 07:02:41
14. ,Hi, (VS2008, VB.Net
I used the above code, but whenever i click on the Button, It just shows
View Tutorial By: Pat at 2012-06-27 17:30:37
15. hi plz help
how do we change project development settings to general development settings...
View Tutorial By: pratik jogwar at 2012-06-07 19:58:47
16. hii
my crys rpt is nt generating bill, it is asking login & password of the database , an
View Tutorial By: Afan Khan at 2012-04-05 16:48:40
17. hey i want to retrieve data from database table and view it in front end and search for a particular
View Tutorial By: Mohammed Mohiuddin at 2012-02-25 09:11:11
18. Hi,
i am using crystal report 9. Once i install my program (vb.net 2008) on any other PC with
View Tutorial By: jeff at 2012-02-12 08:14:15
19. Hey,
The above tutorial is for SQL server,
is there any one who knows how to create cr
View Tutorial By: Anil at 2012-02-07 15:58:06
20. hey, what the hell are you doing.. this kind of plagiarism is not allowed. you are copying contents
View Tutorial By: Ameen at 2012-02-02 08:08:42
21. dear i have different files of ms access 2010 like as file1.accdb, file2.accdb,..... filex.accdb. bu
View Tutorial By: neeo at 2012-01-16 07:02:20
22. It's very use full to me ....
Thans a lot........
View Tutorial By: Raxit at 2011-12-30 03:57:03
23. Microsoft VB.net 2008 not showing Crystal Report Viewer control. So i cannot add Crystal Report View
View Tutorial By: Ali at 2011-11-30 03:21:00
24. your site is ridiculous...
the domain name is "java-samples.com"
and your po
View Tutorial By: ambot at 2011-11-24 08:04:54
25. I am using VS2010 & SAP for crystal report. I have done what you posted.
But I did it wi
View Tutorial By: Abdullah Al Mamun at 2011-08-11 23:20:37
26. Hi sir !
I have two Crystal Report, Named Crystal1 and crystal2,
Is i
View Tutorial By: Anderson Abad at 2011-07-20 03:34:51
27. Hi,
My problem is with daybook. In table , The ledgername is 'Purchase' , But in cry
View Tutorial By: Priyesh at 2011-07-06 06:34:33
28. can you clearly reveal how to create crystal reports and how to make alignments in crystal reports i
View Tutorial By: halim at 2011-07-02 00:28:48
29. sir,
my project is in asp.net so is there any reports to be generated for asp projects .pl
View Tutorial By: mohsin at 2011-04-14 06:25:59
30. Hi,
As you shown here that we have to give the full path of our crystal report but wh
View Tutorial By: Keyur at 2011-04-05 03:30:12
31. Hi,
My problem is that how to connect the report with my access database by using a relative
View Tutorial By: Twahie at 2011-03-21 05:31:06
32. Hi,
my problem is that when i will put my program on another PC, it is asking for the path of
View Tutorial By: Twahir at 2011-03-21 05:24:16
33. hey dude
im using vb.net 2008 and sql server 2005
i followed the steps
but whe
View Tutorial By: Haseeb ur Rehman at 2010-11-12 02:08:48
34. My crystal report keeps asking for a login password?
View Tutorial By: Larry at 2010-07-30 11:58:38
35. hi this is very helpful........thank you very much
View Tutorial By: sumalatha at 2010-06-07 02:16:37
36. hi this is very helpful........thank you very much
View Tutorial By: sumalatha at 2010-06-07 01:53:33
37. very good tutorial..
View Tutorial By: shobhit at 2010-05-04 12:17:41
38. hello,
how to use database access in crystal report?
View Tutorial By: sheng at 2010-04-25 04:08:57
39. hello,
i have to connect the crystal report with the report source dynamically. Is there any
View Tutorial By: shanmugaraj at 2010-03-03 04:08:30
40. hay is there any way to perform operation or calculation
directly on crystal reports, which
View Tutorial By: neha at 2009-11-20 08:30:48
41. hay is there any way to perform operation or calculation
directly on crystal reports, which
View Tutorial By: neha at 2009-11-20 08:30:10
42. hay is there any way to perform operation or calculation
directly on crystal reports, which
View Tutorial By: neha at 2009-11-20 08:29:45
43. hi,
my problem is.......
i use vb.net 2005 i want to put any no to data grid from the
View Tutorial By: Anirban at 2009-10-25 10:25:48
44. hi,
my problem is.......
i use vb.net 2005 i want to put any no to data grid from the
View Tutorial By: Anirban at 2009-10-25 10:15:13
45. hi! this coding is very helpful for me thanks .
View Tutorial By: bhuvaneshwari at 2009-10-18 23:52:58
46. How can I send parameter to crystal report?
View Tutorial By: Mark at 2009-10-14 03:41:36
47. Hi,
i tried this way.that works perfectly.but i make the setup of the project & install
View Tutorial By: indu at 2009-06-08 03:13:51
48. the above is perfect, but when i hit the export button, it opens the save as window, it defaults to
View Tutorial By: CH at 2009-06-02 03:01:34
49. can i have sample of java programming that has database connection and manipulation on SQL 200 and M
View Tutorial By: piolo at 2009-05-31 18:53:25
50. Hey is there any way to export datagrid to crystal reports. Please advice me on this
View Tutorial By: Anu at 2009-05-08 13:11:48
51. Hi Nithya,
yes you can do that see the tutorial on <a href="http://www.java-samples.
View Tutorial By: Ramlak at 2009-03-04 01:20:01
52. Hi ,
Is there any way to export contents of datagridview to crystal report?. bcos i h
View Tutorial By: Nithya Duraiswamy at 2009-03-03 21:32:05
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Using Resume Next and Resume Line in VB.net
Using On Error GoTo 0 in VB.net
Getting an Exception's Number and Description in VB.net
Raising an Exception Intentionally in VB.net
Exception Filtering in the Catch Block in VB.net
Using Multiple Catch Statements in VB.net
Throwing an Exception in VB.net
Throwing a Custom Exception in VB.net
Changes in Controls from VB6 to VB.net
Unstructured Exception Handling in VB.net