How to DataGridView Printing
The DataGridView control offers an exceptional platform for presenting data in a customizable and visually appealing table format. It equips developers with an extensive range of properties, methods, and events that empower them to fine-tune every aspect of the control's appearance and behavior.
However, it is worth noting that the DataGridView control does not provide an inherent printing functionality, which could be seen as a limitation. Nevertheless, ingenious workarounds exist to overcome this limitation and achieve the desired printing capability.
One such approach involves incorporating a PrintDocument object into the project and harnessing the power of the PrintPage event. This event is triggered whenever a new page is ready to be printed, providing an opportune moment to execute the necessary printing operations.
Within the PrintPage event handler, a Bitmap object is ingeniously created, serving as a canvas for rendering the DataGridView's contents. This Bitmap object acts as an intermediary, facilitating the transformation of the DataGridView into a printable format. By skillfully drawing the DataGridView onto this Bitmap object, the desired content is precisely captured and prepared for printing.Full Source VB.NET
In order to run this vb.net project you have to drag two buttons ,one for load data and one for print command, and drag a PrintDocument control on your form . The following picture shows how to drag PrintDocument Object to your project.