How can I integrate Crystal Report 9 along with VB.net (Version 2003). Is it possible to create CR based report in VB.Net? or I've to chose another reporting tool. Plz kindly reply me as soon as possible.
It gives error when I declear CR9 object.
Dim report as new CrystalReport
Which class or library I've to import to ceate CR object. All CR refrences has been added.

Recommended Answers

All 5 Replies

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

via a google search since I am work with none of my references.

But I would give them a try!

I've already Imports thses two files. But here is still an error while declaring CR Object.
Dim report as New CrystalReport(It doesn't show the CrystalReport1 class pressing space after New).
If you've any sample program in which you access crystal report in VB.Net, so please send it to me, it will be more helpfull for me and I'll be very thanxfull to you.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

via a google search since I am work with none of my references.

But I would give them a try!

Re: Error While Declaring Crytal Report Object

--------------------------------------------------------------------------------

I've already Imports thses two files. But here is still an error while declaring CR Object.
Dim report as New CrystalReport(It doesn't show the CrystalReport1 class pressing space after New).
If you've any sample program in which you access crystal report in VB.Net, so please send it to me, it will be more helpfull for me and I'll be very thanxfull to you.

Sure do. Here is the code:

Imports System.Web.Security '   |||||   Required Class for Authentication
Imports System.Data '   |||||   DB Accessing Import
Imports System.Data.OleDb   '   ||||||  Access Database Required Import!
Imports System.Configuration    '   ||||||  Required for Web.Config appSettings |||||

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource

Public Class _1997Sales
	Inherits System.Web.UI.Page
	'   |||||   Database Connection Object  |||||
	Dim MyConn As OleDbConnection = New OleDbConnection(ConfigurationSettings.AppSettings("strConn"))


#Region " Web Form Designer Generated Code "

	'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

	End Sub
	Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer

	'NOTE: The following placeholder declaration is required by the Web Form Designer.
	'Do not delete or move it.
	Private designerPlaceholderDeclaration As System.Object

	Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
		'CODEGEN: This method call is required by the Web Form Designer
		'Do not modify it using the code editor.
		InitializeComponent()
	End Sub

#End Region

	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		'If Not Page.IsPostBack Then
		CreateReport()
		'End If
	End Sub

	Private Sub CreateReport()
		Dim objReport As New Sales1997
		Dim myResults As CrystalDecisions.CrystalReports.Engine.Table
		Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
		For Each myResults In objReport.Database.Tables
			myLogin = myResults.LogOnInfo
			myLogin.ConnectionInfo.UserID = "admin"
			myResults.ApplyLogOnInfo(myLogin)
		Next
		CrystalReportViewer1.ReportSource = objReport

	End Sub


End Class

Hope this helps...

i have added a report to my project named Sales1997.rpt
But Sales1997 is underlined when i write this line giving message that
" Type 'Sales1997' is not defined. "
PS: it does not show class Sales1997 when i write new in following line, i have to write it myself.

Dim objReport As New Sales1997

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.