C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » .NET »

print report directly to printer with crystal report


Posted Date: 06 Oct 2008      Posted By: shalu      Member Level: Bronze     Points: 1   Responses: 1



hi

I developed point of sale system with vb.net 2005 version.


1)how do I print invoice directly to printer with crystal report ?
2)How do I change report server name and database name in run time from vb.net




please help me to complete this job

Thanks





Responses

Author: Neha Srivastava    06 Oct 2008Member Level: GoldRating: 4 out of 54 out of 54 out of 54 out of 5     Points: 6

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;

on button print click
/////////repindividual is report name, dsIndReqApprov is datasource
repIndividual.SetDataSource(dsIndReqApprov.Tables[dsIndReqApprov.IndividualRequAppr.TableName]);
ReportDocument crReportDocument;
this.printDialog1.Document = this.printDocument1;
DialogResult diolog = this.printDialog1.ShowDialog();
if (diolog == DialogResult.OK)
{
string PrinterName = this.printDocument1.PrinterSettings.PrinterName;
crReportDocument = new ReportDocument();
crReportDocument = repIndividual;
try
{
crReportDocument.PrintOptions.PrinterName = PrinterName;
crReportDocument.PrintToPrinter(1, true, 1, 1);
//crReportDocument.PrintOptions.PageMargins.bottomMargin = printSetup.bottomPageMargin;
//Let the user know that the print job is completed
MessageBox.Show("Report finished printing!", "Purchase Requisition", MessageBoxButtons.OK, MessageBoxIcon.Information);

//frm.Show();
}
catch (Exception err)
{
MessageBox.Show(err.ToString());
}
}



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : Get Session Value when session gets timed out
Previous : How can I create a windows forms workspace area
Return to Discussion Forum
Post New Message
Category: .NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use