Hi
Look in the simplest form . you will be adding a PrintDocument object to
your class
private System.Drawing.Printing.PrintDocument printDocument1;
you might add a printdialog and set its printdocument properety to your
print document.
You might also need to add PageSettings and assign it to your printdocument.
PageSettings myPageSettings=new PageSettings();
printDocument1.DefaultPageSettings=myPageSettings;
the only thing that you have to do in order to print is to write a handler
to the printpage event of the printdocumnet object
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.PageUnit=GraphicsUnit.Millimeter; //set the mode that you
will be using
//then to write values form the dataset or the datagrid this is your
decision
To write just use
private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString("these are the values that are inside my dataset");
e.Graphics.DrawString(ds.Tables[0][0].Tostring()
;
//after you enter one complete row you can then draw a line before
//starting the new row
e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Red)),0,0,100,100);
//then you check to see if you are done or not, if not set the has //more
pages to true so the print event would be fired again to print //more pages
If(//your test condition , the data in the dataset is done or not may be){
e.HasMorePages =true;
}else { e.HasMorePages =false;
}
}
hope that would help