473,226 Members | 1,385 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 software developers and data experts.

Print Report directly to Printer

Hi,
I want to print crystal report directly to printer using vb.net application without any dialog box. how can i achieve this?

CrystalReportViewer1.ReportSource = System.Environment.CurrentDirectory & "\MiniStatement.rpt"
'CrystalReportViewer1.Show()
CrystalReportViewer1.PrintReport()

Thanks:
Danish Majid
May 21 '07 #1
12 22598
kenobewan
4,871 Expert 4TB
Please search the site, there are a few examples of this.
May 21 '07 #2
I search the site but the examples here are for printing the text file to printer and i unable to find any query to print crystal report directly to printer.
Any help?
May 21 '07 #3
Motoma
3,237 Expert 2GB
I search the site but the examples here are for printing the text file to printer and i unable to find any query to print crystal report directly to printer.
Any help?
Most Crystal Reports Reports have a PrintToPrinter member to call.
May 21 '07 #4
Hi Danishce,
You can try PrinttoPrinter Method.
write this code in any button click event

Expand|Select|Wrap|Line Numbers
  1.  /* Print the report. Set the no. of copies, collate (false or true), startPageN and endPageN . set startPageN and endPageN parameters to 0 to print all pages.*/
  2.                         reportobject.PrintToPrinter(1, true, 0, 0);
Before that bind the report to the report object.
May 22 '07 #5
Thanks all for helping me but still i can not find PrinttoPrinter method in the crystalreportviewer dropdownlist inside my vb.net application.can you guide me step-by-step how to do this?
Report name =rptStatement.rpt
Crystal Report Control Name=CrystalReportViewer1
Crystal Report Version=9.2.0.448
Visual Studio .NET 2003=vb.net

//Code
CrystalReportViewer1.ReportSource = "rptStatement.rpt"
CrystalReportViewer1.PrintReport()

but when i use CrystalReportViewer1.PrinttoPrinter() method it does not appear in properties & gives error.

Please help me what i missed here?
Thanks
May 22 '07 #6
using the code below the PrinttoPrinter method appears
Dim obj As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
obj.PrintToPrinter(1, True, 0, 0)
but gives the following error :
error=D:\rptStatement.rpt Cannot find custom tool 'CrystalDecisions.VSDesigner.CodeGen.ReportCodeGen erator' on this system.

and also how can i set the name and location of report?
May 22 '07 #7
Motoma
3,237 Expert 2GB
using the code below the PrinttoPrinter method appears
Dim obj As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
obj.PrintToPrinter(1, True, 0, 0)
but gives the following error :
error=D:\rptStatement.rpt Cannot find custom tool 'CrystalDecisions.VSDesigner.CodeGen.ReportCodeGen erator' on this system.

and also how can i set the name and location of report?
Take a look at this link for a demonstration on report printing.
May 22 '07 #8
MyReport.PrintToPrinter(1,False,0,0)
In the above code, how i create report object named MyReport because when i create object the report name does not appear.Report name is "RptStatement.rpt"
dim MyReport as new RptStatement
it gives the error.
Please help me out on how i create report object or can i miss any referenece to report?
May 23 '07 #9
Just Write

Dim cr as new crystalreport1
cr.printtoprinter(1,false,1,1)


That's all Cheers
May 23 '07 #10
Thanks All for helping me out,I have finally succeeded using following code:
Dim obj As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim m_rptname As String
m_rptname = System.Environment.CurrentDirectory & "\MiniStatement.rpt"
obj.Load(m_rptname)
obj.PrintToPrinter(1, True, 0, 0)
May 24 '07 #11
Motoma
3,237 Expert 2GB
Thanks All for helping me out,I have finally succeeded using following code:
Dim obj As New CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim m_rptname As String
m_rptname = System.Environment.CurrentDirectory & "\MiniStatement.rpt"
obj.Load(m_rptname)
obj.PrintToPrinter(1, True, 0, 0)
I am glad you have found a solution to your problem. Come back any time you have a question.
May 24 '07 #12
Hi,

Good to hear about your sucess
But I didn't get sucess in my problem
My problem is to export the report in .txt format in vb.net 2003 environment
this project is pending from about 1yr
Please help me

Regards
Aatish
May 24 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Khalid Hussain | last post by:
hi How I could print a report on printer using SQL 2000? I am not going in detail about the report as at the moment I need to know how produce reports on printer. Thank you *** Sent via...
5
by: Tony Dong | last post by:
Hi there, I am newer for dot net I want to make a report and then print it, the report may include images and text, how can I do that, any one can give me a suggestion? I know how to...
0
by: Ray | last post by:
Hi all, I would like to ask is there any method for printing the crystal report directly by choosing printer without previewing the report using CrystalReportViewer? Thanks a lot, Ray
1
by: Ray | last post by:
Hi all, Is it possible to print the crystal report directly in vb.net without previewing it? Thanks a lot, Ray
3
by: printline | last post by:
Hello Guys I cannot print from a locally installed printer that is mapped to a windows 2003 sever. I have installed the printer locally and can print locally. I connect to the windows 2003...
0
by: silverrock7 | last post by:
Hello Friends i m stuck up to a place wherein i want to print a report which is displaying on a reportviewer. I actually want to send the report to printer directly without viewing it. i am...
1
by: Saberthedream | last post by:
Hello, I am creating a crystal report in .net and i need to print the crystal report directly without showing it to user . for this i am writing code Report.PrintToPrinter(1, true, 0, 0); but...
1
by: =?Utf-8?B?SmJhcmJlcg==?= | last post by:
All users in my XP Professional PC were able to print to a network printer until now. Now, the only account that can print to the network printer is the admin account. I have an HP PSC 2200 series...
0
by: Zulqarnain | last post by:
I have developed a report in developer 6i. It properly prints on laser printer but it do not print on receipt printer (CZERLOP). Printing job has sent to printer & printer also detect this job but...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.