I am writing an app to print formatted data using Visual Studio 2008/C#. I have formatted the data in the fashion that I want it to display. I am using two Print Documents and event handlers, because the first page of the report carries formatting requirements that differs from pages 2 through N.
Print Preview shows me properly formatted data for all pages that I try to print. Nevertheless, pages 2 through N will not actually print.
I've stepped through my code and the data is being passed correctly to the event handler. This is the block of code that calls the second print document's event handler. What am I doing wrong?
// First page print limit has been reached. Do we
// still have unprinted items in the arraylist? Call the second
// print handler event and print those items.
if (((alItemsToPrint.Count) - iItemPrintedCount) > 0)
{
// Getting a look at my formating
PrintPreviewDialog printPreview2 = new PrintPreviewDialog();
printPreview2.Document = ItemsPrintDocument;
printPreview2.ShowDialog();
printPreview2.Dispose();
// Print item overflow pages
ItemsPrintDocument.Print();
// Release the resources consumed by this print document
ItemsPrintDocument.Dispose();
}
Thanks for your time, everyone.