473,399 Members | 2,146 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,399 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 22616
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.