Add CrystalDecisions references to your project and drag the ReportViewer control onto your form.
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms
CrystalDecisions.ReportSource
'----Create a DataTable containing the data for the report:
Imports System.Data.OleDb
Dim strConnection As String = "..."
Dim Connection As New OleDbConnection(strConnection)
Dim strSQL As String = "Select * From Employee"
Dim DA As New OleDbDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS, "Employee")
'----Verify the path to the Crystal Report's .RPT file:
Dim strReportPath As String = Application.StartupPath & _
"\" & strReportName & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to find crystal report file:" & _
vbCrLf & strReportPath))
End If
'----Load the Crystal report's .RPT file and pass in the DataTable:
Dim cr As New ReportDocument
cr.Load(strReportPath)
cr.SetDataSource(DS.Tables("Employee"))
'-----Set the CrystalReportViewer's appearance and set the ReportSource:
CrystalReportViewer.ShowRefreshButton = False
CrystalReportViewer.ShowCloseButton = False
CrystalReportViewer.ShowGroupTreeButton = False
CrystalReportViewer.ReportSource = cr
'------Loading a report when the report's DataSource is a .NET DLL
Dim strReportPath As String = Application.StartupPath & "\" & _
strReportName & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & _
vbCrLf & strReportPath))
End If
'---Load the Crystal report's .RPT file:
Dim cr As New ReportDocument
cr.Load(strReportPath)
'---Set the CrystalReportViewer's appearance and set the ReportSource:
CrystalReportViewer.ShowRefreshButton = False
CrystalReportViewer.ShowCloseButton = False
CrystalReportViewer.ShowGroupTreeButton = False
CrystalReportViewer.ReportSource = cr
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :