Click here to Skip to main content
15,914,163 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
HI , I have developed a windows application and added print functionality to it , but it does not print. The print dialog box appears but when the print button is invoked , nothing happens.
Below is the code I have :
C#
private void toolStripPrintBtn_Click(object sender, EventArgs e)
        {
            if(listViewPageViewer.Items.Count > 0)
            {
                for (int i = 0; i < listViewPageViewer.Items.Count; i++)
                {
                    if (listViewPageViewer.Items[i].Selected)
                    //i have also tried .Checked instead of .Selected
                    {
                        printDialog.ShowDialog();
                    }
                }
            }
        }



Thanks in Advance
Posted

1 solution

Hey Riccardo,

First off, you've not technically added the functionality if it doesn't print. :-D heheh...

In all seriousness, showing the dialog doesn't mean that you've invoked the print job[^]. You'll need some other code there to get the document to the printer.

Cheers.
 
Share this answer
 
Comments
Rico_ 22-Sep-10 2:36am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
Rico_ 22-Sep-10 3:00am    
thanks MrJames ... I honestly thought that just adding the print dialog would sort the problem out. :-O

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900