I have an application that has a DataGridView control, which holds data that I want to print out when the \"print\" button is pushed.
So far I have got
Write the below code for print the datagridview:-
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bm = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
dataGridView1.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));
e.Graphics.DrawImage(bm, 0, 0);
}
source https://www.mindstick.com/Articles/1356/datagridview-printing-in-c-sharp
this will work exactly