I'm going through the lessons, learning c#.
I have a problem in chapter 9 with the printDocument methods.
I open a text file, and click the print button,
The printer comes up and kicks out a page, but the page is blank.
Same thing for printing to a file or oneNote.
Here's a the parts of the code that I've added for the print methods
using System.IO;
using System.Drawing.Printing;
void PrintDoc() {
try {
if (printDialog1.ShowDialog() == DialogResult.OK) {
printDocument1.Print();
}
}
catch (InvalidPrinterException ex) { MessageBox.Show(ex.Message); }
}
private void mnuFilePrint_Click(object sender, EventArgs e) {
PrintDoc();
}
private void toolStripButton3_Click(object sender, EventArgs e) {
PrintDoc();
}
Can someone tell me what I'm doing wrong, other than the HTML formating in this message?
Thanks,
-=Carey
carey313@gmail.com
I'm going through the lessons, learning c#.
I have a problem in chapter 9 with the printDocument methods.
I open a text file, and click the print button,
The printer comes up and kicks out a page, but the page is blank.
Same thing for printing to a file or oneNote.
Here's a the parts of the code that I've added for the print methods
using System.IO;
using System.Drawing.Printing;
void PrintDoc() {
try {
if (printDialog1.ShowDialog() == DialogResult.OK) {
printDocument1.Print();
}
}
catch (InvalidPrinterException ex) { MessageBox.Show(ex.Message); }
}
private void mnuFilePrint_Click(object sender, EventArgs e) {
PrintDoc();
}
private void toolStripButton3_Click(object sender, EventArgs e) {
PrintDoc();
}
Can someone tell me what I'm doing wrong, other than the HTML formating in this message?
Thanks,
-=Carey
carey313@gmail.com
add new comment
did you choose the right document in the properties of printpreviewdialog1?