Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
simple code to print values from a datagridview in c# application
I want to print datagridview values.
Posted
Comments
chandrashekhar racharla 20-Jan-12 4:52am    
Not clear your question

Use this code
C#
PrintDialog myPrintDialog = new PrintDialog();
            System.Drawing.Bitmap memoryImage = new System.Drawing.Bitmap(panel1.Width, panel1.Height);
            panel1.DrawToBitmap(memoryImage, panel1.ClientRectangle);
            if (myPrintDialog.ShowDialog() == DialogResult.OK)
            {
                System.Drawing.Printing.PrinterSettings values;
                values = myPrintDialog.PrinterSettings;
                myPrintDialog.Document = printDocument1;
                printDocument1.PrintController = new StandardPrintController();
                printDocument1.Print();
            }
            printDocument1.Dispose();

datagridview in place of panel1
 
Share this answer
 
v2

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