For improved printing encapsulated in an extended DGV, see:


Here's an example i wrote to answer a Code Gallery request.



The example shows how to print text + a multiple page DataGridView using a PrintDocument Component + GDI+. It also shows how to preview your printing in a System.Windows.Forms.PrintPreviewDialog.

This is designed + written dynamically, i.e. it's not a one time code, it's versatile + can be used for any multi (printed) page DataGridView. Try resizing the Columns or Rows + you'll see what I mean.

The majority of the code in this example is for calculating printed page ranges for printing the DataGridView. The actual printing is very simple, as it uses standard GDI+ techniques in the PrintDocument1_PrintPage event (System.Drawing.Printing.PrintDocument).

The Graphics Device Interface (GDI) is a Microsoft Windows application programming interface and core operating system component responsible for representing graphical objects and transmitting them to output devices such as monitors and printers.
GDI is responsible for tasks such as drawing lines and curves, rendering fonts and handling palettes. VB.Net printing is far simpler + faster than pre VB.Net versions of Visual Basic.

If you find this example useful or helpful, please take the time to rate it, or if you have any questions, ask in the Questions + Answers part of this page. Thanks.