crystal report
-
Hi everyone, Not sure if this is the right place for crystal report posts but here I go. I have a windows application that has been coded in vb.net, in VS2003. the database is MS Access based. I am working on a quotation system and have completed the forms that the user will utilize for input. The windows apps created are not bound to the database and store a local dataset that holds all of the information/tables/data that the user has came in contact with. I would like to create reports that will be populated based on the local dataset. I was wondering if there is any way to create a crystal report, to be used as the template, without binding the report to the database, and then passing the local dataset data into the report that needs to be printed. I have read online about a push method, but they say that can be really slow in creating a report with lots of tables and data, and all of the other solutions are for vs2005. Thank you for reading this post, I am new to crystal reports and am looking for any tutorials etc that might help with this problem. Thank you.
eatwork
-
Hi everyone, Not sure if this is the right place for crystal report posts but here I go. I have a windows application that has been coded in vb.net, in VS2003. the database is MS Access based. I am working on a quotation system and have completed the forms that the user will utilize for input. The windows apps created are not bound to the database and store a local dataset that holds all of the information/tables/data that the user has came in contact with. I would like to create reports that will be populated based on the local dataset. I was wondering if there is any way to create a crystal report, to be used as the template, without binding the report to the database, and then passing the local dataset data into the report that needs to be printed. I have read online about a push method, but they say that can be really slow in creating a report with lots of tables and data, and all of the other solutions are for vs2005. Thank you for reading this post, I am new to crystal reports and am looking for any tutorials etc that might help with this problem. Thank you.
eatwork
eatwork wrote:
working on a quotation system
eatwork wrote:
not bound to the database
Just a question - don't you think it would be nice (from a customer services point of view) to keep track of quotes and use them as follow-ups? e.g. If the quote was not accepted, why not? Your app, just a suggestion.
eatwork wrote:
create a crystal report, to be used as the template, without binding the report to the database, and then passing the local dataset data into the report that needs to be printed.
Sure there is & it's real simple. Build your template report first and pass the dataset to the method that calls the report, e.g.
'declare pre-built report
Public myReport1 = New myCrystalReportPublic Sub BuildMyReport(ByVal ds As DataSet)
myReport1.SetDataSource(ds)
myForm.myReportViewer.ReportSource = myReport1End Sub
Is that what you're after?
-
eatwork wrote:
working on a quotation system
eatwork wrote:
not bound to the database
Just a question - don't you think it would be nice (from a customer services point of view) to keep track of quotes and use them as follow-ups? e.g. If the quote was not accepted, why not? Your app, just a suggestion.
eatwork wrote:
create a crystal report, to be used as the template, without binding the report to the database, and then passing the local dataset data into the report that needs to be printed.
Sure there is & it's real simple. Build your template report first and pass the dataset to the method that calls the report, e.g.
'declare pre-built report
Public myReport1 = New myCrystalReportPublic Sub BuildMyReport(ByVal ds As DataSet)
myReport1.SetDataSource(ds)
myForm.myReportViewer.ReportSource = myReport1End Sub
Is that what you're after?
Thank you for your reply and insight. I currently do store the quotes in a database but do not store the reasons why they might/might not have been accepted. But I will ask the users if that is something they would like in the system. I tried the code you suggested, but it doesn't seem to be working for me. The form opens, but without a report in the report viewer. This code is in the pop up form after the user clicks on a button and I call the forms showdialog method my code:
Private Sub Form_Load() myReport1.SetDataSource(Me.p_dataset) Me.CrystalReportViewer1.ReportSource = myReport1 End sub also tried Private Sub Form_Load() myReport1.SetDataSource(Me.p_dataset) Me.CrystalReportViewer1.ReportSource = myReport1.FilePath.ToString End sub
Do you know of any place on the internet that might give me a tutorial to create a "template report"? All of the reports I have seen online are databinded to a database or have a database/xsd file that it reads data in from. I can't really use those examples because my dataset is created at runtime. I am fairly new to .net and coding, and have never done a crystal report through the integrated crystal reports in vs2003. Thank you very mucheatwork
-
Thank you for your reply and insight. I currently do store the quotes in a database but do not store the reasons why they might/might not have been accepted. But I will ask the users if that is something they would like in the system. I tried the code you suggested, but it doesn't seem to be working for me. The form opens, but without a report in the report viewer. This code is in the pop up form after the user clicks on a button and I call the forms showdialog method my code:
Private Sub Form_Load() myReport1.SetDataSource(Me.p_dataset) Me.CrystalReportViewer1.ReportSource = myReport1 End sub also tried Private Sub Form_Load() myReport1.SetDataSource(Me.p_dataset) Me.CrystalReportViewer1.ReportSource = myReport1.FilePath.ToString End sub
Do you know of any place on the internet that might give me a tutorial to create a "template report"? All of the reports I have seen online are databinded to a database or have a database/xsd file that it reads data in from. I can't really use those examples because my dataset is created at runtime. I am fairly new to .net and coding, and have never done a crystal report through the integrated crystal reports in vs2003. Thank you very mucheatwork
Ok, I did up a small sample app to demonstrate how to get this right. Here's how I did it. I started off by creating a form with 3 textboxes to input data to the dataset (I chose "Name", "Product" & "Quantity" as fields for the dataset), and 2 buttons for "Add to dataset" & "View report". I created the dataset (called dsQuote) and declared it at modular level in Form1 (
Friend ds1 As New dsQuote
) I created a second form and added a Crystal Report Viewer to it (called "crv") I added a new Crystal Report to the solution and used the Report Expert wizard to select the dataset i created earlier. I set the solution start up object to callSub Main()
. Then I just tied it all together with a bit of code - have a look at the code below. SubMainModule modMain
Public WithEvents frm1 As Form1 Public WithEvents frmR As frmReport Sub Main() frm1 = New Form1 Application.Run(frm1) End Sub
End Module
Code on Form1
Friend ds1 As New dsQuote
Private Sub btnAdd\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim dr As DataRow = ds1.tblQuote.NewRow 'add info to dataset dr.Item("name") = txtName.Text dr.Item("product") = txtProduct.Text dr.Item("quantity") = txtQuantity.Text ds1.tblQuote.Rows.Add(dr) 'clear the textboxes txtQuantity.Clear() txtProduct.Clear() With txtName .Clear() .Focus() End With End Sub Private Sub btnReport\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click frmR = New frmReport frmR.Show() End Sub
Code on Form2
Public rptQ As Quote
Private Sub frmReport\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load rptQ = New Quote rptQ.SetDataSource(frm1.ds1) Me.crv.ReportSource = rptQ End Sub
That should solve it for you. :) EDIT: Sorry for the crappy naming conventions, I was in a bit of a hurry. :) -- modified at 3:59 Friday 18th August, 2006
-
Ok, I did up a small sample app to demonstrate how to get this right. Here's how I did it. I started off by creating a form with 3 textboxes to input data to the dataset (I chose "Name", "Product" & "Quantity" as fields for the dataset), and 2 buttons for "Add to dataset" & "View report". I created the dataset (called dsQuote) and declared it at modular level in Form1 (
Friend ds1 As New dsQuote
) I created a second form and added a Crystal Report Viewer to it (called "crv") I added a new Crystal Report to the solution and used the Report Expert wizard to select the dataset i created earlier. I set the solution start up object to callSub Main()
. Then I just tied it all together with a bit of code - have a look at the code below. SubMainModule modMain
Public WithEvents frm1 As Form1 Public WithEvents frmR As frmReport Sub Main() frm1 = New Form1 Application.Run(frm1) End Sub
End Module
Code on Form1
Friend ds1 As New dsQuote
Private Sub btnAdd\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim dr As DataRow = ds1.tblQuote.NewRow 'add info to dataset dr.Item("name") = txtName.Text dr.Item("product") = txtProduct.Text dr.Item("quantity") = txtQuantity.Text ds1.tblQuote.Rows.Add(dr) 'clear the textboxes txtQuantity.Clear() txtProduct.Clear() With txtName .Clear() .Focus() End With End Sub Private Sub btnReport\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click frmR = New frmReport frmR.Show() End Sub
Code on Form2
Public rptQ As Quote
Private Sub frmReport\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load rptQ = New Quote rptQ.SetDataSource(frm1.ds1) Me.crv.ReportSource = rptQ End Sub
That should solve it for you. :) EDIT: Sorry for the crappy naming conventions, I was in a bit of a hurry. :) -- modified at 3:59 Friday 18th August, 2006
-
Ok, I did up a small sample app to demonstrate how to get this right. Here's how I did it. I started off by creating a form with 3 textboxes to input data to the dataset (I chose "Name", "Product" & "Quantity" as fields for the dataset), and 2 buttons for "Add to dataset" & "View report". I created the dataset (called dsQuote) and declared it at modular level in Form1 (
Friend ds1 As New dsQuote
) I created a second form and added a Crystal Report Viewer to it (called "crv") I added a new Crystal Report to the solution and used the Report Expert wizard to select the dataset i created earlier. I set the solution start up object to callSub Main()
. Then I just tied it all together with a bit of code - have a look at the code below. SubMainModule modMain
Public WithEvents frm1 As Form1 Public WithEvents frmR As frmReport Sub Main() frm1 = New Form1 Application.Run(frm1) End Sub
End Module
Code on Form1
Friend ds1 As New dsQuote
Private Sub btnAdd\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim dr As DataRow = ds1.tblQuote.NewRow 'add info to dataset dr.Item("name") = txtName.Text dr.Item("product") = txtProduct.Text dr.Item("quantity") = txtQuantity.Text ds1.tblQuote.Rows.Add(dr) 'clear the textboxes txtQuantity.Clear() txtProduct.Clear() With txtName .Clear() .Focus() End With End Sub Private Sub btnReport\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click frmR = New frmReport frmR.Show() End Sub
Code on Form2
Public rptQ As Quote
Private Sub frmReport\_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load rptQ = New Quote rptQ.SetDataSource(frm1.ds1) Me.crv.ReportSource = rptQ End Sub
That should solve it for you. :) EDIT: Sorry for the crappy naming conventions, I was in a bit of a hurry. :) -- modified at 3:59 Friday 18th August, 2006