Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 297359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:37:57+00:00 2026-05-12T06:37:57+00:00

I am working on Crystal Reports for Visual Studio 2005. I need to change

  • 0

I am working on Crystal Reports for Visual Studio 2005. I need to change the default printer, and the number of copies to 2 as compared to the default of 1.

I have succeeded to change the default printer using below code.

static int SetAsDefaultPrinter(string printerDevice)
{
    int ret = 0;
    try
    {   
        string path = "win32_printer.DeviceId='" + printerDevice + "'";
        using (ManagementObject printer = new ManagementObject(path))
        {
            ManagementBaseObject outParams =
            printer.InvokeMethod("SetDefaultPrinter",
            null, null);
            ret = (int)(uint)outParams.Properties["ReturnValue"].Value;                
        }
    }
}

How can I change the number of copies printed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:37:57+00:00Added an answer on May 12, 2026 at 6:37 am

    .Net Framework doesn’t provide any mechanism to override the default print functionality. So I disabled the default print button, and added a button name Print.Code for the Event Handler follows below.

    private void Print_Click(object sender, EventArgs e)
    {
        try
        {
            PrintDialog printDialog1 = new PrintDialog();
            PrintDocument pd = new PrintDocument();
    
            printDialog1.Document = pd;
            printDialog1.ShowNetwork = true;
            printDialog1.AllowSomePages = true;
            printDialog1.AllowSelection = false;
            printDialog1.AllowCurrentPage = false;
            printDialog1.PrinterSettings.Copies = (short)this.CopiesToPrint;
            printDialog1.PrinterSettings.PrinterName = this.PrinterToPrint;
            DialogResult result = printDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
                PrintReport(pd);
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
    
    private void PrintReport(PrintDocument pd)
    {
        ReportDocument rDoc=(ReportDocument)crvReport.ReportSource;
        // This line helps, in case user selects a different printer 
        // other than the default selected.
        rDoc.PrintOptions.PrinterName = pd.PrinterSettings.PrinterName; 
        // In place of Frompage and ToPage put 0,0 to print all pages,
        // however in that case user wont be able to choose selection.
        rDoc.PrintToPrinter(pd.PrinterSettings.Copies, false, pd.PrinterSettings.FromPage,
           pd.PrinterSettings.ToPage); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with Crystal Reports in VB.NET in Visual Studio 2005. I have a
I have a Crystal Reports project that I am working on where I need
I am using the Crystal Reports designer that came with Visual Studio 2008. My
I'm designing a report using Crystal reports for Visual Studio 2010. In my report
I am a Crystal Reports developer and I have always been working with Oracle
I am a Crystal Reports developer and I have always been working with Oracle
Working with Crystal Reports over a multiple database environment. In the past reports have
I have a Crystal Report created in Visual Studio 2008 which displays various stock
I'm working on a ASP.Net application (.Net 1.1) with Crystal Reports 2003. I have
I am working with CrystalDecisions.CrystalReports.Engine.ReportDocument in WinForms in Visual Studio 2008. Right now when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.