Hi guys, i was wondering if anyone could demonstrate the proper way to use PrintPreviewDialog. the goal in this situation is to simply open the print preview form to print what is in my main textbox for a notepad application. I have checked out the tutorial on the site for making a notepad
I get an error on this line of the tutorialCode://Declare preview as a new PrintPreviewDialog PrintPreviewDialog preview = new PrintPreviewDialog(); //Declare prntDoc_PrintPage as a new EventHandler for prntDoc's Print Page prntDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(prntDoc_PrintPage); //Set the PrintPreview's Document equal to prntDoc preview.Document = prntDoc; //Show the PrintPreview Dialog if (preview.ShowDialog(this) == DialogResult.OK) { //Generate the PrintPreview prntDoc.Print(); }
It says that prntDoc_PrintPage doesnt exsist in the current context even if i addCode:prntDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(prntDoc_PrintPage);to the beginning. any ideas? +rep as alwaysCode:System.Drawing.Printing.PrintDocument prntDoc = new System.Drawing.Printing.PrintDocument();
I don't know whats giving you the error I get it to, but I searched up and down Google and can't find a way to print preview a textboxs text.What you might have to do is save the textbox.text as a temporary document then print preview that but I'm not sure.
Knowledge: Intermediate C#, Beginner AS3, HTML, CSS, Binary, Hex, Octal.
Science is only an educated theory, which we cannot disprove.
Does anyone know how printpreviewdialog could be used in this situation? im dying without this i have been searching for soo long and havent found anything that is working.
k! i figured some of it out..
opens the print preview dialog but i cant figure out how to get it to import the text in richTextBox1 to the printpreview form.Code:PrintDocument prntDoc = new PrintDocument(); PrintPreviewDialog pDialog = new PrintPreviewDialog(); pDialog.Show();
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks