Crystal Report 9 & VB.net 2002
Hello:
I am trying to learn vb.net (I came from vb6), I have ordered several books but none are in yet.
This is all I need at this time.
I have two forms in my project, form1 will have a button with code in it to call form2 which will have my CRViewer on it. (I can't ever figure out how to call form2 to show.
The CRViewer will open up my one report. Please can someone give me some code examples?
Thank you for your help
Re: Crystal Report 9 & VB.net 2002
Can you explain your question again actually I am not able to understand your question.
Are you want to make CR with the CRViewer in the Vb.Net?
Re: Crystal Report 9 & VB.net 2002
I will try.
I have already created my report with Crystal report 9. The report name is "InvoiceTotals.rpt" the database connection & selection formula is already saved in the report.
I have created a vb project with just 2 forms. Form1 will just have a button on it (Nothing else) Form2 will have CRViewer on it set up to show the above report.
I need the code that when I press the Button on form1 it will Show form2 and the Crviewer will display my above report.
Thank you again.
I hope this is better.
Re: Crystal Report 9 & VB.net 2002
In the method you are using two forms, so it is not the good programming, Use the crystal report control. And see all the report on the one form. Read the crystal report tutorial at my signature for more detail.
Want to say one more thing that you are saying about the vb and the thread title .net so what is this.?? :confused:
Re: Crystal Report 9 & VB.net 2002
I want to thank your for trying to help.
The Crystal report tutorial you have a link to is for vb6.
I am using Visual Studio.Net 2002 (VB.Net)
Can you provide a VB.Net and Crystal Report Tutorial?
Thanks Again.
Re: Crystal Report 9 & VB.net 2002
There is difference between the connection with the Access and the SQL server.
Just click on the Database connection at my signature for connection with the database either sql server of ms access.
Related to the crystal report Just use the code, and change the connection and the SQL query according to your condition.
VB Code:
Dim CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer = New CrystalDecisions.Windows.Forms.CrystalReportViewer
Dim Report As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
CrystalReportViewer1.ActiveViewIndex = 0
CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
CrystalReportViewer1.Location = New System.Drawing.Point(0, 0)
CrystalReportViewer1.Name = "CrystalReportViewer1"
Dim QueryString As String = "select * from TableName" 'Your Query here and the table name
Dim Connection As New OleDbConnection(funcs.con) 'Your Database Connection Here
Connection.Open()
Dim Adapter As OleDbDataAdapter = New OleDbDataAdapter(querystring, connection)
Dim DataSet As DataSet = New DataSet() 'DataSet
Adapter.Fill(DataSet)
Dim DataTable As DataTable = New DataTable 'DataTable
DataTable = DataSet.Tables(0)
Report.Load(Application.StartupPath & "/ReportName.rpt") 'Report Name Here
Report.SetDataSource(DataTable)
CrystalReportViewer1.ReportSource = Report