I'm trying to print out the contents arr of objects, but all I get is a print out of my project name. I guess printing is working, but probably not correctly building my "result" so it can print out the contents. I don't really understand why, if someone can help me?
// Prints
private void button2_Click(object sender, EventArgs e)
{
PrintPreviewDialog preview = new PrintPreviewDialog();
PrintDocument recordDoc;
// Create the document and name it
recordDoc= new PrintDocument();
recordDoc.PrintPage += new PrintPageEventHandler(this.PrintReceiptPage);
// Preview document
preview.Document = recordDoc;
preview.ShowDialog();
// Dispose of document when done printing
recordDoc.Dispose();
}
private void PrintReceiptPage(object sender, PrintPageEventArgs e)
{
string result = "";
// Print
Font myFont = new Font("Courier", 12);
for (int i = 0; i < arr.Length; i++)
{
result += Convert.ToString(arr[i]);
}
e.Graphics.DrawString(result , myFont, Brushes.Black, 0, 0);
}