[RESOLVED] [2005] Write to Crystal Report
Hi everybody and i wish u all a happy new year.
Am working on a project whereby i have to send some informations to a crystal report. Am using Visual Studio 2005. I would like to do some query to the SQL server then do some manipulations with the data and then send some of the data manipulated to report. I can do the query and the manipulation alright but i don't how to send the informations to the text box placed on my report.
Can someone please help?
Thank you.
Re: [2005] Write to Crystal Report
Re: [2005] Write to Crystal Report
you can create a parameter in the report then make the textbox in the report equal to the parameter value then sent the parameter value by code
Re: [2005] Write to Crystal Report
Hi, MANNO
That is exactly what am trying to do but i dont know how to do the codings, am very new to Crystal report. Pls help.
WaZda
Re: [2005] Write to Crystal Report
ok here is the code:
the Imports:
Code:
Imports Microsoft.Reporting.WinForms
and here is the code in the Button:
Code:
Dim sDate As New ReportParameter("Report_Parameter_1", CType(DateTimePicker1.Value.ToShortDateString, Date))
Dim eDate As New ReportParameter("Report_Parameter_2", CType(DateTimePicker1.Value.ToShortDateString, Date))
Dim TName As New ReportParameter("Report_Parameter_3", CType(TextBox1.Text, String))
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {sDate, eDate, TName})
ReportViewer1.RefreshReport()
I hope it helps
Good Luck
Note:
This is a visual basic code
Re: [2005] Write to Crystal Report
Hi MANNO,
Am having an error with the "ReportParameter" saying the type is not defined. Can u help me on dat?
Plus the scenario is dat:
form1: I will do the data manipulation in the form1 then finally send the information to the form2.
form2: i have a report viewer to load the report file. Informations should be received from form1 by codes onto the report.
Re: [2005] Write to Crystal Report
Hi MANNO,
Thank you very much for your help. i tried to understand your code but i just couldn't. and it is because i did make myself clear enough. So i'll try explaining better this time, here is the scenario:
I have 3 files: Form1, Form2 and CrytalReport1.rpt(which is the crystal report file)
form1: I will do the data manipulation in the form1 then finally send the information to the form2.
form2: i have a CrystalReportViewer to load the CrystalReport file (CrytalReport1.rpt). Informations should be received from form1 by codes and displayed in the various textbox, placed on the CrytalReport1.rpt .
I hope this one is much clearer. and once again, thank you for helping me.
WaZda
1 Attachment(s)
Re: [2005] Write to Crystal Report
Here is a working demo. This should explain everything you need to know, and you SHOULD have no problem applying this to your own project.
Re: [2005] Write to Crystal Report
Oh my GOD,
kleinma dude, u solved my problem. This is great man. your project Rocks. Am so grateful to you buddy. Really.
Re: [RESOLVED] [2005] Write to Crystal Report
sometimes a demo is worth a 1000 posts trying to explain something ;)
Re: [RESOLVED] [2005] Write to Crystal Report
sure man, you a RIIIIIIIIIIIght. thank u. u saved me on this one.
Take care.
WaZda
Re: [RESOLVED] [2005] Write to Crystal Report
Kleinma,
One more question pls. I have some other print out that should follow the first one. And what am trying to do is,
1.if possible, get to know the printer the user selected then use that printer for the other printings.
2. Freeze the app with some progress bar to wait till the end of all the printings before going back to it.
Thank you for your help. Coz u r really helping me and i appreciate that.
WaZda