HOW TO PRINT A DATAGRID VIEW IN C#
This example demonstrate how we can print Datagridview control in
c#. This example requires a button control named Button1, one
datagridview control named datagridview1 and one Printdocument component
named printdocument1.
and try this code:
and try this code:
-
private void button2_Click(object sender, EventArgs e)
-
{
-
printDocument1.Print();
-
}
-
private void printDocument1_PrintPage(object sender,
-
System.Drawing.Printing.PrintPageEventArgs e)
-
{
-
PaintEventArgs myPaintArgs = new PaintEventArgs(e.Graphics,
-
new Rectangle(new Point(0, 0), this.Size));
-
this.InvokePaint(dataGridView1, myPaintArgs);
-
}
Comments
Post a Comment